[erlang-questions] Getting count of suites/cases from common test hook

Max Lapshin max.lapshin@REDACTED
Tue May 23 21:30:09 CEST 2017


handle_event(#event{name=start_info, data =
{_NoOfTests,_NoOfSuites,NoOfCases}}, #state{} =State) ->
  {ok, State#state{cases = NoOfCases}};


handle_event(#event{name=tc_done, data = _Data}, #state{done = Done,
started_at = Start} =State) ->
  Out = io_lib:format("~5.2f% ~Bs", [Done1*100/State#state.cases, (now_ms()
- Start) div 1000]),
  io:format(standard_error, "~s\e[~BD", [Out, iolist_size(Out)]),
  {ok, State#state{done = Done1}};


handle_event(#event{name=test_stats,data =
{Ok,Failed,{UserSkipped,AutoSkipped}}}, #state{} = State) ->
  {ok, State#state{
    ok = Ok + State#state.ok,
    failed = Failed + State#state.failed,
    skipped = UserSkipped + AutoSkipped + State#state.skipped
  }};


handle_event(#event{name=test_done}, #state{} =State) ->
  io:format(standard_error, "Total: ~Bs \n"
  ....


ct_run calculates number of test cases before start, so you can make a
spinner with percents.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170523/9a078874/attachment.htm>


More information about the erlang-questions mailing list