Randomly, the integration test \Tuleap\Baseline\REST\BaselineArtifactControllerIntTest::testGetWithoutQuery
would fail, with an obscure comparison error:
Tuleap\Baseline\REST\BaselineArtifactControllerIntTest::testGetWithoutQuery
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'epic #9'
+'artifact title'
It is obscure because in the test itself, the actual artifact seems to be created with the expected title. It turns out the test builder for baseline artifacts had some static
state, where it would keep track of the artifact ID and auto-increment it. Depending on the order in which tests are run, it could happen that it would create 9 artifacts. The code would then find the "automatically created" artifact with id #9 instead of the manually created one, leading to the comparison error.
In summary: avoid state in test builders. They should be stateless and pure. Set IDs manually if they are important for the test. Don't rely on state, as it will affect other tests.