5. 执行testng的一系列操作之解析参数
//
// Parse the arguments
//
try {
CommandLineArgs cla = new CommandLineArgs();
m_jCommander = new JCommander(cla, argv);
validateCommandLineParameters(cla);
result.configure(cla);
}
catch(ParameterException ex) {
exitWithError(ex.getMessage());
}
5.1 创建命令行参数对象
public class CommandLineArgs {
@Parameter(description = "The XML suite files to run")
public List<String> suiteFiles = Lists.newArrayList();
public static final String LOG = "-log";
public static final String VERBOSE = "-verbose";
@Parameter(names = { LOG, VERBOSE }, description = "Level of verbosity")
public Integer verbose;
public static final String GROUPS = "-groups";
@Parameter(names = GROUPS, description = "Comma-separated list of group names to be run")
public String groups;
public static final String EXCLUDED_GROUPS = "-excludegroups";
@Parameter(names = EXCLUDED_GROUPS, description ="Comma-separated list of group names to "
+ " exclude")
public String excludedGroups;
......
命令行参数有:
Options:
-configfailurepolicy
Configuration failure policy (skip or continue)
-d
Output directory
-dataproviderthreadcount
Number of threads to use when running data providers
-excludegroups
Comma-separated list of group names to exclude
-groups