The ct_run program is automatically installed with Erlang/OTP and the CommonTest application (for more
information, see section Installation in the User's Guide). The program accepts different start flags.
Some flags trigger ct_run to start CommonTest and pass on data to it. Some flags start an Erlang node
prepared for running CommonTest in a particular mode.
The interface function ct:run_test/1, corresponding to the ct_run program, is used for starting CommonTest from the Erlang shell (or an Erlang program). For details, see the ct manual page.
ct_run also accepts Erlang emulator flags. These are used when ct_run calls erl to start the Erlang node
(this makes it possible to add directories to the code server path, change the cookie on the node, start
more applications, and so on).
With the optional flag -erl_args, options on the ct_run command line can be divided into two groups:
• One group that CommonTest is to process (those preceding -erl_args).
• One group that CommonTest is to ignore and pass on directly to the emulator (those following
-erl_args).
Options preceding -erl_args that CommonTest does not recognize are also passed on to the emulator
untouched. By -erl_args the user can specify flags with the same name, but with different destinations,
on the ct_run command line.
If flags -pa or -pz are specified in the CommonTest group of options (preceding -erl_args), relative
directories are converted to absolute and reinserted into the code path by CommonTest. This is to avoid
problems loading user modules when CommonTest changes working directory during test runs. However,
CommonTest ignores flags -pa and -pz following -erl_args on the command line. These directories are
added to the code path normally (that is, on specified form).
Exit status is set before the program ends. Value 0 indicates a successful test result, 1 indicates one
or more failed or auto-skipped test cases, and 2 indicates test execution failure.
If ct_run is called with option -help, it prints all valid start flags to stdout.
RunTestsfromCommandLine
ct_run -dir TestDir1 TestDir2 .. TestDirN |
[-dir TestDir] -suite Suite1 Suite2 .. SuiteN
[-group Groups1 Groups2 .. GroupsN] [-case Case1 Case2 .. CaseN]
[-step [config | keep_inactive]]
[-config ConfigFile1 ConfigFile2 .. ConfigFileN]
[-userconfig CallbackModule1 ConfigString1 and CallbackModule2
ConfigString2 and .. CallbackModuleN ConfigStringN]
[-decrypt_key Key] | [-decrypt_file KeyFile]
[-label Label]
[-logdir LogDir]
[-logopts LogOpts]
[-verbosity GenVLevel | [Category1 VLevel1 and
Category2 VLevel2 and .. CategoryN VLevelN]]
[-silent_connections [ConnType1 ConnType2 .. ConnTypeN]]
[-stylesheet CSSFile]
[-cover CoverCfgFile]
[-cover_stop Bool]
[-event_handler EvHandler1 EvHandler2 .. EvHandlerN] |
[-event_handler_init EvHandler1 InitArg1 and
EvHandler2 InitArg2 and .. EvHandlerN InitArgN]
[-include InclDir1 InclDir2 .. InclDirN]
[-no_auto_compile]
[-abort_if_missing_suites]
[-multiply_timetraps Multiplier]
[-scale_timetraps]
[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]
[-repeat N] |
[-duration HHMMSS [-force_stop [skip_rest]]] |
[-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]]
[-basic_html]
[-no_esc_chars]
[-keep_logs all | NLogs]
[-ct_hooks CTHModule1 CTHOpts1 and CTHModule2 CTHOpts2 and ..
CTHModuleN CTHOptsN]
[-ct_hooks_order test | config]
[-exit_status ignore_config]
[-help]
RunTestsusingTestSpecification
ct_run -spec TestSpec1 TestSpec2 .. TestSpecN
[-join_specs]
[-config ConfigFile1 ConfigFile2 .. ConfigFileN]
[-userconfig CallbackModule1 ConfigString1 and CallbackModule2
ConfigString2 and .. and CallbackModuleN ConfigStringN]
[-decrypt_key Key] | [-decrypt_file KeyFile]
[-label Label]
[-logdir LogDir]
[-logopts LogOpts]
[-verbosity GenVLevel | [Category1 VLevel1 and
Category2 VLevel2 and .. CategoryN VLevelN]]
[-allow_user_terms]
[-silent_connections [ConnType1 ConnType2 .. ConnTypeN]]
[-stylesheet CSSFile]
[-cover CoverCfgFile]
[-cover_stop Bool]
[-event_handler EvHandler1 EvHandler2 .. EvHandlerN] |
[-event_handler_init EvHandler1 InitArg1 and
EvHandler2 InitArg2 and .. EvHandlerN InitArgN]
[-include InclDir1 InclDir2 .. InclDirN]
[-no_auto_compile]
[-abort_if_missing_suites]
[-multiply_timetraps Multiplier]
[-scale_timetraps]
[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]
[-repeat N] |
[-duration HHMMSS [-force_stop [skip_rest]]] |
[-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]]
[-basic_html]
[-no_esc_chars]
[-keep_logs all | NLogs]
[-ct_hooks CTHModule1 CTHOpts1 and CTHModule2 CTHOpts2 and ..
CTHModuleN CTHOptsN]
[-ct_hooks_order test | config]
[-exit_status ignore_config]
RefreshHTMLIndexFiles
ct_run -refresh_logs [-logdir LogDir] [-basic_html]
[-keep_logs all | NLogs]
RunCommonTestinInteractiveMode
ct_run -shell
[-config ConfigFile1 ConfigFile2 ... ConfigFileN]
[-userconfig CallbackModule1 ConfigString1 and CallbackModule2
ConfigString2 and .. and CallbackModuleN ConfigStringN]
[-decrypt_key Key] | [-decrypt_file KeyFile]
StartaCommonTestMasterNode
ct_run -ctmaster
SeeAlso
For information about the start flags, see section Running Tests and Analyzing Results in the User's
Guide.
Ericsson AB erts 15.2.3 ct_run(1)