I need to run some code after all ExUnit have stopped. The only way I know how to do this is by writing a custom formatter, but it feels very wrong… I can handle all messaging to a master process myself, I just need a way to send a message to the master process saying that all tests have stopped and I can aggregate the statistics I’ve gathered. Is there a way of doing this?
I think a custom formatter is generally the way to go: How do can I write code to be run *after* tests are executed?
I know that’s a possibility, but I don’t like the idea of calling something a “formatter” when it’s actually a code coverage tool… But if there isn’t anything else that’s what I’ll have to use.
There’s a hook for coverage systems
Nice! That’s what I wanted
OK, I’m now trying a different approach in which I would like to run the test suite several times. The idea would be to run the test suite once, recompile the code, and then run the test suite again. This would repeat several times. Is there a way of running the test suite several times in a way that don’t break in a new ExUnit version?
I don’t think there is a straightforward way to do this. Perhaps you could accomplish this with
ExUnit.run ? https://hexdocs.pm/ex_unit/ExUnit.html#run/0