@@ -66,10 +66,30 @@ handle_event(#event{name = tc_start,
6666 data = {Suite , init_per_suite }},
6767 State0 = #{device := D ,
6868 test_stats := TestStats }) ->
69- print (D , " ~n~p : " , [Suite ]),
70- State1 = maps :put (suite , Suite , State0 ),
69+ % % When Suite is ct_framework the real suite lacks init_per_suite;
70+ % % defer header printing until the first real tc_start arrives.
71+ SuiteName = case Suite of
72+ ct_framework -> pending ;
73+ _ -> print (D , " ~n~p : " , [Suite ]), Suite
74+ end ,
75+ State1 = maps :put (suite , SuiteName , State0 ),
7176 State = maps :put (suite_stats0 , TestStats , State1 ),
7277 {ok , State };
78+ handle_event (# event {name = tc_start ,
79+ data = {Suite , {init_per_group , GroupName , _ }}},
80+ State = #{device := D , suite := pending })
81+ when Suite =/= ct_framework ->
82+ % % Resolve deferred suite header from first init_per_group
83+ print (D , " ~n~p : " , [Suite ]),
84+ State1 = maps :put (suite , Suite , State ),
85+ {ok , maps :put (group , GroupName , State1 )};
86+ handle_event (# event {name = tc_start ,
87+ data = {Suite , Case }},
88+ State = #{device := D , suite := pending })
89+ when is_atom (Case ), Case =/= end_per_suite ->
90+ % % Resolve deferred suite header from first test case
91+ print (D , " ~n~p : " , [Suite ]),
92+ {ok , maps :put (suite , Suite , State )};
7393handle_event (# event {name = tc_start ,
7494 data = {_Suite , {init_per_group , GroupName , _ }}},
7595 State ) ->
0 commit comments