[erlang-bugs] eunit multiple calls a test / eunit local works incorrect (?)

systemio systemio <>
Thu Jan 12 18:56:44 CET 2012


here is a simple test in fs_tests.erl module
test1_test_() ->
	?debugFmt("Test ~p",[self()]) ,
	S = fun() -> ?debugFmt("Setup ~p",[self()]) end,
	C = fun(_) -> ?debugFmt("Cleanup ~p",[self()]) end,
	F = fun(_) -> fun() -> ?debugFmt("Test Check ~p",[self()]) end end,
	{foreach,local,S,C,[F]}.

Run test:
eunit:test([{inparallel,fs}],[{report,{eunit_surefire,[{dir,"./Reports"}]}}]).
Got:
./src/fs_tests.erl:85:<0.94.0>: Test <0.94.0>
./src/fs_tests.erl:85:<0.94.0>: Test <0.94.0>
./src/fs_tests.erl:85:<0.94.0>: Test <0.94.0>
./src/fs_tests.erl:86:<0.94.0>: Setup <0.94.0>
./src/fs_tests.erl:88:<0.96.0>: Test Check <0.96.0>
./src/fs_tests.erl:87:<0.94.0>: Cleanup <0.94.0>
  Test passed.
ok

1. Why are  there 3 Test <0.94.0>, i expect only one?
2. Why does Test Check <0.96.0> have another process id?

My reasoning:
eunit:test([{inparallel,fs}],[... is a general rule while {foreach,local,... is more specific - that is why i expect union process id.


Run test (without inparallel):
eunit:test([fs],[{report,{eunit_surefire,[{dir,"./Reports"}]}}]).
Got:
./src/fs_tests.erl:85:<0.103.0>: Test <0.103.0>
./src/fs_tests.erl:85:<0.103.0>: Test <0.103.0>
./src/fs_tests.erl:86:<0.103.0>: Setup <0.103.0>
./src/fs_tests.erl:88:<0.103.0>: Test Check <0.103.0>
./src/fs_tests.erl:87:<0.103.0>: Cleanup <0.103.0>
  Test passed.
ok

Now Test Check has the same process id, but why are there already 2 Test <0.103.0>, i expect only one?

~
Thx


More information about the erlang-bugs mailing list