Can common test execute groups in parallel?

I puzzled on parallel execution of ct groups. In principle I have two test groups, that could potentially execute in parallel. Something like this

{test, [parallel],[
    {atest, [sequence], [atest1, atest2]},
    {btest, [sequence], [btest1, btest2]}
]}

now as far I can see, the btest-group does not execute in parallel, but starts after the atest group has finished. And in the ct manual, there’s this statement:

However, as test cases are never executed in parallel with init_per_group/2 or end_per_group/2 of the same group, it is only after a nested group has finished that remaining parallel cases in the previous group become spawned.

I have to say I don’t understand the above sentence …

Is there a way to have the two sequential groups to work in parallel? (yes, I want to have the tests inside the groups sequential, as they share a common resource (sensor input simulator))

2 Likes

okey, this chapter from the common_test/src/test_server_ctrl.erl makes it a bit more clear

%% -------------------------------------------------------------------
%% Notes on parallel execution of test cases
%% -------------------------------------------------------------------
%%
%% A group nested under a parallel group will start executing in
%% parallel with previous (parallel) test cases (no matter what
%% properties the nested group has). Test cases are however never
%% executed in parallel with the start or end conf case of the same
%% group! Because of this, the test_server_ctrl loop waits at
%% the end conf of a group for all parallel cases to finish
%% before the end conf case actually executes. This has the effect
%% that it’s only after a nested group has finished that any
%% remaining parallel cases in the previous group get spawned ().
%% Example (all parallel cases):
%%
%% group1_init |---->
%% group1_case1 | --------->
%% group1_case2 | --------------------------------->
%% group2_init | ---->
%% group2_case1 | ------>
%% group2_case2 | ---------->
%% group2_end | —>
%% group1_case3 (
)| ---->
%% group1_case4 (*)| →
%% group1_end | —>

1 Like

Important note: sequence tag that you used in the original post has semantic that’s not exactly expected. It does not mean “execute my test cases sequentially one by one”. It actually means "my test cases depend on each other, so if there is {atest, [sequence], [case1, case2]} group definition, and case1 fails, then case2 will be skipped. Because sequence means “if any test in the sequence fails, skip all other tests in the sequence”.

If you just want to execute tests sequentially (that is, not in parallel), just don’t add any options in there:

{atest, [], [atest1, atest2]}

I tripped over this many more times that I want to admit.

6 Likes