Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I skip an eunit test?

Tags:

erlang

eunit

I wonder how to mark a specific test in eunit in a way that will force it to be ignored (ie compiled, but not executed) on the next test run. I'm asking this question in a TDD context, ie I'd like to refactor in the green, but still have some test cases that I'll get to later.

I'd rather not comment-out the test, that is a good way of forgetting about it. eunit's test summary line does have a skipped line, but I could not find any docs about that functionality.

like image 315
jupp0r Avatar asked Feb 06 '12 15:02

jupp0r


1 Answers

You can temporarily remove '_test' suffix from test's name (or add any other, e.g. '_ignore'). It will compile, but won't show up in the summary (as it will be treated like a regular function and thus will be ignored by eunit).

This is a workaround of course, eunit should support such functionality, but I'm afraid it doesn't.


EUnit's notion of "skipped" means that something prevented the test from running, such as a compilation failure, the node that was in charge of the test crashing, or the setup failing.

This concept is pretty deeply embedded in the code, so there's no simple way to get user-skipped tests.

like image 52
Wacław Borowiec Avatar answered Oct 20 '22 09:10

Wacław Borowiec