Each time random number of tests are run in a file

Hi,

I am running a test file (using ExUnit.Case) which has for example around 10 tests in it. However, each time I run it, different number of them are fired. Sometimes it’s just 4 and sometimes 7.

I can’t find a reason for it. I will be grateful for help.

Hard to say without the test output, but are there any tests that stop the BEAM instance? (e.g. System.exit) This would cause ExUnit to stop as well. Try running mix test ––trace, this should hint at which test causes the issue.

The reason why it‘s a different number of tests executed each time is that tests are executed in a random order. You can see the seed used in the output, something like Randomized with seed <seed>. You can rerun the tests with the same seed: mix test ––seed <seed>.