美文网首页
testng group注解的解析

testng group注解的解析

作者: 测试的旅途中 | 来源:发表于2020-10-09 13:43 被阅读0次

2.在写测试用例的时候可以进行分组测试,关键字为group,展示如下
""

public class TestGroup {
String name ="";
@BeforeClass(groups= {"slow"})
public void setUp() {
    name="测试一下分组";
}

@Test(groups= {"fast"})
public void fastTest() {
    System.out.print("fast"+name);
}

@Test(groups= {"slow"})
public void slowTest() {
    System.out.print("slow"+name);
}

}

""
2.我们还需要配置运行的xml文件
<?xml version="1.0" encoding="UTF-8"?>
<suite name="testsuit">
<test name="test" >
<classes>
<class name="test.TestGroup"></class>
</classes>
<groups>
<run>
<include name="slow"></include>
</run>
</groups>
</test>
</suite>
3.右键运行xml文件后结果如下

image.png

相关文章

  • testng group注解的解析

    2.在写测试用例的时候可以进行分组测试,关键字为group,展示如下"" } ""2.我们还需要配置运行的xml文...

  • TestNG的group注解

    在使用testng时,常使用@Beforeclass来做一些初始化工作,但是在@Test注解中加入了group属性...

  • TestNG注解使用与测试技巧

    TestNG注解的使用 TestNG执行结果顺序 其中的BeforeMethod/AfterMethod�会在每个...

  • 测试框架TestNG使用介绍

    今天分享TestNG测试框架的基础知识,使用TestNG的优点,TestNG的基本注解如何使用,套件、忽略、异常、...

  • testNG

    1.testng.xml结构规则 2.TestNG注解 用于在测试类中注解: 3.Java文件的测试用例中通过获取...

  • TestNG

    注解 执行顺序 testng.xml tag详解

  • TestNG注解

    各个注解运行顺序为: @BeforeSuite->@BeforeTest->@BeforeClass->{@Bef...

  • 2.testng杂记

    1.testng中主要常用的注解方法,如图1所示: 2.testng中注解方法执行的先后顺序,如图2所示:

  • Junit和Testng区别

    1.都有注解,但TestNG更丰富 2.TestNG的BeforeClass和AfterClass不需要方法为静态...

  • 编程语言与测试框架

    testng 流程控制注解:@BeforeSuite@BeforeTest@BeforeClass@BeforeM...

网友评论

      本文标题:testng group注解的解析

      本文链接:https://www.haomeiwen.com/subject/kwjlpktx.html