如何使用testng标签进行烟熏,回归测试 [英] How to use testng tag for smoke, regression tests

查看:92
本文介绍了如何使用testng标签进行烟熏,回归测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几种测试方法,我需要选择其中一些作为冒烟测试,而其他选择为回归测试.我该如何在Testng硒中建立条件/依赖性,所以烟雾测试将首先作为一组运行.而且我可以为回归测试设置不同的Bamboo工作,并且只有在烟雾测试小组通过的情况下,这些工作才会运行.

I have several test methods and i need to select some of them as smoke tests and others regression tests. How can i make a condition/dependency in Testng selenium, So smoke tests will run first as a group. And i can set up different Bamboo job for regression tests and those will be running only if smoke test group passed.

这是我的测试:

@Test(priority=1)
public void test_1(){
----}

@Test(priority=2)
public void test_2(){
----}

@Test(priority=3)
public void test_3(){
----}

@Test(priority=4)
public void test_4(){
----}

@Test(priority=5)
public void test_5(){
----}

在这里,test_1至test_3是烟雾测试.因此,如果他们通过其他人,将被处决.我该怎么办?

Here, test_1 to test_3 are smoke tests. So if they pass others will be executed. How can i do that?

推荐答案

您可以使用 dependsOnGroups 批注.文档中的示例非常好.基本上,您可以尝试这样的事情:

You can achieve this by using the groups and dependsOnGroups annotations. The examples in the documentation are pretty good. Basically you could try something like this:

@Test (groups = {"smokeTest"}, priority=1)
public void test_1() {...}

// add the same annotations for test_2 and test_3

@Test (groups = {"regressionTest"}, dependsOnGroups = {"smokeTest"}, priority=4) 
public void test_4() {...}

@Test (groups = {"regressionTest"}, dependsOnGroups = {"smokeTest"}, priority=5) 
public void test_5() {...}

这样,只有在测试1,2和3通过的情况下,才会执行测试4和5.如果您需要更精细的控制,可以考虑使用 testng.xml 设置测试套件等.

This way tests 4 and 5 will only be executed if tests 1,2 and 3 pass. If you need more granular control, you could consider using testng.xml to set up test suites etc.

关于在Bamboo中设置作业的方法,取决于您使用的构建工具.此

As for setting up the jobs in Bamboo, it depends on the build tool you are using. This post on Atlassian community may be helpful for you.

希望这会有所帮助.

这篇关于如何使用testng标签进行烟熏,回归测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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