Running ExUnit test cases in the exact order they are described.

1,009 views
Skip to first unread message

miwee

unread,
May 9, 2015, 9:46:48 AM5/9/15
to elixir-l...@googlegroups.com
I want to run my all the test cases in a test file in the exact order they are described. I tried with async: false, but test cases are still run in some randomized order.
Any suggestions.

thanks
miwee

Norbert Melzer

unread,
May 9, 2015, 10:21:35 AM5/9/15
to elixir-l...@googlegroups.com

Using 0 as seed *seems* to avoid randomisation, but my small project I did that test has only 10 test wich printed their corresponding number. The numbers appeared in order.

--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/22da7659-dd38-4873-88e2-a034f1569472%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

José Valim

unread,
May 9, 2015, 10:35:50 AM5/9/15
to elixir-l...@googlegroups.com
Yes, setting seed: 0 on ExUnit start or via the command line does it. But it is for the whole suite and not that particular test case.

Relying on ordering for tests is usually not recommended.


--


José Valim
Skype: jv.ptec
Founder and Lead Developer

miwee

unread,
May 9, 2015, 12:02:10 PM5/9/15
to elixir-l...@googlegroups.com, jose....@plataformatec.com.br
Its working. thanks.
In this particular test case I wanted to test an external API. So I thought that doing it in order from POST, GET All, Get one, Put, Get one would be better. Is there any other way this can be done?

thanks
miwee

Louis Pilfold

unread,
May 9, 2015, 12:07:10 PM5/9/15
to elixir-lang-talk
I would do it all within one test block, with multiple assertions.

Cheers,
Louis
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-ta...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-talk/b55abc00-79b7-459e-b07f-06a2a305a2ca%40googlegroups.com.

José Valim

unread,
May 9, 2015, 12:09:12 PM5/9/15
to elixir-l...@googlegroups.com
Yeah, right now you would do a big test but that is definitely flawed. We are working on making integration tests better in the future.



José Valim
Skype: jv.ptec
Founder and Lead Developer

Louis Pilfold

unread,
May 9, 2015, 12:43:44 PM5/9/15
to elixir-lang-talk
I like the idea for integration tests on the ShouldI issue tracker, if
anyone would like to take a stab at building that I would be very
happy. :)

https://github.com/batate/shouldi/issues/9
> https://groups.google.com/d/msgid/elixir-lang-talk/CAGnRm4Lwgevb_-Gn3LK5%2BnUOoC3wU02s0_G5uMX-XbkO0iGboQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages