非常教程

Erlang 20参考手册

common_test

ct_run

命令

ct_run

命令摘要

用于从OS命令行启动Common Test的程序。

描述

ct_run程序会自动安装Erlang / OTP和Common Test应用程序(有关更多信息,请参见Installation用户指南中的部分)。该程序接受不同的开始标志。一些标志触发ct_run开始Common Test并将数据传递给它。一些标志启动一个Erlang节点,准备Common Test在特定模式下运行。

接口函数ct:run_test/1对应于ct_run程序,用于Common Test从Erlang shell(或Erlang程序)启动。有关详细信息,请参阅ct手册页。

ct_run也接受Erlang仿真器标志。这些在ct_run调用erl启动Erlang节点时使用(这可以将目录添加到代码服务器路径,更改节点上的cookie,启动更多应用程序等等)。

使用可选标志-erl_argsct_run命令行上的选项可以分为两组:

  • 一组即将Common Test处理(前面那些-erl_args)。
  • 一组Common Test将忽略并直接传递给模拟器(后面的那些组-erl_args)。

-erl_args那些Common Test不能识别的选项也不会被传递给仿真器。由-erl_args用户可以使用相同的名称指定标志,但与不同的目的地,则在ct_run命令行。

如果标志-pa-pzCommon Test选项组(前面-erl_args)中指定,则相关目录将转换为绝对值,然后通过重新插入代码路径Common Test。这是为了避免Common Test在测试运行期间更改工作目录时加载用户模块的问题。但是,Common Test忽略命令行上的标志-pa-pz跟随-erl_args。这些目录通常会添加到代码路径中(即以指定的形式)。

程序结束前设置退出状态。值0表示测试成功,1表示一个或多个失败或自动跳过的测试用例,并2指示测试执行失败。

如果ct_run用选项调用-help,它将打印所有有效的开始标志stdout

从命令行运行测试

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]
 [-muliply_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]
 [-exit_status ignore_config]
 [-help]

使用测试规范运行测试

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]
 [-muliply_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]
 [-exit_status ignore_config]

在基于Web的GUI中运行测试

ct_run -vts [-browser Browser]
 [-dir TestDir1 TestDir2 .. TestDirN] |
 [[dir TestDir] -suite Suite [[-group Group] [-case Case]]]
 [-config ConfigFile1 ConfigFile2 .. ConfigFileN]
 [-userconfig CallbackModule1 ConfigString1 and CallbackModule2
   ConfigString2 and .. and CallbackModuleN ConfigStringN]
 [-logopts LogOpts]
 [-verbosity GenVLevel | [Category1 VLevel1 and
  Category2 VLevel2 and .. CategoryN VLevelN]]
 [-decrypt_key Key] | [-decrypt_file KeyFile]
 [-include InclDir1 InclDir2 .. InclDirN]
 [-no_auto_compile]
 [-abort_if_missing_suites]
 [-muliply_timetraps Multiplier]
 [-scale_timetraps]
 [-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]
 [-basic_html]
 [-no_esc_chars]
 [-keep_logs all | NLogs]

刷新HTML索引文件

ct_run -refresh_logs [-logdir LogDir] [-basic_html]
 [-keep_logs all | NLogs]

在交互模式下运行公共测试

ct_run -shell
 [-config ConfigFile1 ConfigFile2 ... ConfigFileN]
 [-userconfig CallbackModule1 ConfigString1 and CallbackModule2
  ConfigString2 and .. and CallbackModuleN ConfigStringN]
 [-decrypt_key Key] | [-decrypt_file KeyFile]

启动通用测试主节点

ct_run -ctmaster

另见

有关开始标志的信息,请参阅Running Tests and Analyzing Results用户指南中的一节。

Erlang 20

Erlang 是一种通用的面向并发的编程语言,可应付大规模开发活动的程序设计语言和运行环境。

主页 https://www.erlang.org/
源码 https://github.com/erlang/otp
版本 20
发布版本 20.1