Erlang - Skip test suite immediately in common test

313 views Asked by At

I know the way to skip test suite is:

Let init_per_suite function return {skip, reason} value. But It will execute all commands in the init_per_suite function before skip.

I want to skip test suite immediately when a condition is met.

1

There are 1 answers

0
evnu On BEST ANSWER

Maybe just test the condition early in init_per_suite and abort:

init_per_suite(Config) ->
    case abort_condition_met() of
        true ->
            {skip,abort_condition_met};
        false ->
            %% run functions
            Config
    end.

Or you can omit the testsuite from the command to start common_test. For example, if you run common_test using ct_run, create a config which suites your requirements.