【问题标题】:Testng Test Suite xml - Stop execution and generate reportTestng 测试套件 xml - 停止执行并生成报告
【发布时间】:2017-05-13 16:09:33
【问题描述】:

我的 Test_Suite.xml 文件中列出了许多 testng 测试用例

<suite name="google" verbose="3">
<parameter name="selenium.host" value="localhost"></parameter>
<parameter name="selenium.port" value="4444"></parameter>
<parameter name="selenium.browser" value="*firefox"></parameter>
<parameter name="selenium.url" value="http://www.google.com"></parameter>
<test name="name2" preserve-order="true">
<classes>
<class name="com.TestSuite.TestCase1">
<methods>
<include name="tc_TestCase1"></include>
</methods>
</class>
<class name="com.TestSuite.TestCase2">
<methods>
<include name="tc_TestCase2"></include>
</methods>
</class>
...
</classes>
</test>
</suite>

现在如果我运行 .xml 文件,它将运行每个测试用例并最终为测试用例生成报告(通过/失败)

现在,我正在构建一个 GUI 界面,它允许您通过单击按钮来运行测试用例。 我想知道我是否添加了停止命令,有什么方法可以停止 testng 测试用例的执行并为所有之前执行的测试用例生成报告?

目前我的“运行测试用例”命令

    // Create object of TestNG Class
    TestNG runner=new TestNG();

    // Create a list of String
    List<String> suitefiles=new ArrayList<String>();

    // Add xml file which you have to execute
    suitefiles.add("<file path>\\test_suite.xml");

    // now set xml file for execution
    runner.setTestSuites(suitefiles);

    // finally execute the runner using run method
    runner.run();

【问题讨论】:

    标签: java automation testng


    【解决方案1】:

    您可以创建和注册自己的ITestListener,它将实时更新您的 GUI(如 eclipse)。

    查看the logging part of the documentation了解更多详情。

    【讨论】:

      猜你喜欢
      • 2019-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-19
      相关资源
      最近更新 更多