按特定顺序执行测试套件 [英] Execute test suites in a specific order

查看:35
本文介绍了按特定顺序执行测试套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 maven-failsafe 插件来触发配置类似于

I'm using the maven-failsafe plugin to trigger testng suites with configuration similar to

<suiteXmlFiles>
 <file>src/test/resources/suites/somesuite.xml</file>
 <file>src/test/resources/suites/anothersuite.xml</file>
 <file>src/test/resources/suites/yetanothersuite.xml</file>
</suiteXmlFiles>

但是套件或其中的测试没有以正确的顺序执行.有没有办法指定套件应按以下顺序执行

but the suites or the tests within them are not getting executed in the correct order. Is there a way to specifiy that the suites should be executed in the below order

  1. somesuite.xml
  2. anothersuite.xml
  3. 又一个suite.xml

我不关心套件中测试的执行顺序,但只想在前一个套件完成后执行一个套件.是否有一些配置可以用来实现相同的目标?

I don't care about the order in which the tests within a suite is executed, but would like to execute one suite only after the previous one has completed. Is there some configuration which I could use to achieve the same?

推荐答案

创建一个单独的 testng.xml 文件并添加如下内容:

Create a seperate testng.xml file and add something like below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
    <suite-files>
        <suite-file
            path="path-to\suite1.xml" />
        <suite-file
            path="path-to\suite2.xml" />
    </suite-files>
</suite>

然后将此 testng.xml 文件添加到您的 maven 套件中

And then add this testng.xml file to your maven suite

这篇关于按特定顺序执行测试套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆