X Tutup
The Wayback Machine - https://web.archive.org/web/20211005014048/https://github.com/ampproject/amp-toolbox-php/pull/328
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add randomly-ordered unit test run to GHA workflow #328

Merged
merged 4 commits into from Aug 25, 2021

Conversation

@schlessera
Copy link
Collaborator

@schlessera schlessera commented Aug 25, 2021

This PR adds a single PHPUnit run that is randomly ordered.

This can detect scenarios where the test makes assumptions that are only fulfilled by global state manipulated by a previous test, but are not true in the actual logic to be tested.

In case such a randomly ordered test run fails, the random seed can be found in the GHA log so that this particular ordering can be replicated locally.

Also, to make this work, it also fixes the one test that was dependent on ordering (Dom\ElementTest::testAddAmpAction).

/cc @swissspidy

@schlessera schlessera requested a review from ediamin Aug 25, 2021
@schlessera schlessera added this to the 0.7.0 milestone Aug 25, 2021
tests/Dom/ElementTest.php Outdated Show resolved Hide resolved
@schlessera schlessera requested a review from ediamin Aug 25, 2021
@schlessera schlessera merged commit e0e6899 into main Aug 25, 2021
17 checks passed
@schlessera schlessera deleted the fix/order-dependent-tests branch Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
X Tutup