Skip to content

Commit

Permalink
kucumberl return exit(1) if some scenario failed
Browse files Browse the repository at this point in the history
  • Loading branch information
telemaco committed Dec 14, 2012
1 parent be28bac commit e02d246
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions src/kucumberl_cli.erl
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,22 @@ main(Args) ->

kucumberl_log:set_color(Conf#conf.color),

case Conf#conf.task of
help ->
usage(OptSpecList);
list ->
task(list, Conf);
runtests ->
task(runtests, Conf);
_ -> ignoreit
Result =
case Conf#conf.task of
help ->
usage(OptSpecList),
ok;
list ->
task(list, Conf);
runtests ->
task(runtests, Conf);
_ -> ignoreit
end,
case Result of
error ->
kucumberl_utils:exit(1);
_ ->
ignoreit
end;
{error, {_Reason, _Data}} ->
usage(OptSpecList)
Expand Down Expand Up @@ -178,7 +186,8 @@ task(list, Conf) ->
]),
ok
end,
lists:foreach (PrintFeature, Conf#conf.features);
lists:foreach (PrintFeature, Conf#conf.features),
ok;

task(runtests, Conf) ->
Features = lists:foldl(
Expand All @@ -193,7 +202,13 @@ task(runtests, Conf) ->
lists:foldl(fun(F, L) -> L ++ [kucumberl_feature:run(F)] end,
[],
Features),
kucumberl_log:print_stats();
kucumberl_log:print_stats(),

ScnFailed = length(ets:match(kctx, {{'$1', status, '$2', '$3'}, failed})),
case ScnFailed of
0 -> ok;
_ -> error
end;
error -> error
end.

0 comments on commit e02d246

Please sign in to comment.