zoukankan      html  css  js  c++  java
  • testng基础功能使用

    testng简介
     
    1.@Test注解
     
    2.@BeforeClass(alwaysRun = true)
    ((beforeSuite, beforeTest, beforeTestClass , beforeTestMethod)
     
    3.@AfterClass(alwaysRun = true)/@AfterMethod
    对于每个bufore方法(beforeSuite, beforeTest, beforeTestClass 和 beforeTestMethod, 但是不包括 beforeGroups):
    如果设置为true,被配置的方法将总是运行而不管它属于哪个组。
    对于after方法(afterSuite, afterClass, ...): 如果设置为true,被配置的方法甚至在一个或多个先调用的方法失败或被忽略时也将运行。
     
    4.priority
    @Test(priority = 1)
    不填写,默认是0
    执行顺序从小到大
    可以进行简单的参数传递
     
    5.invocationCount
    当前方法被调用的次数
    @Test(invocationCount= 10)
     
    6.threadPoolSize
    当前方法的线程池大小
    @Test(threadPoolSize = 10)
     
    7.@DataProvider
     
    @DataProvider(name = "data")
    public Object[][] testData2() {
    return new Object[][]{
    {"value1","value2","value2"},
    {"value1","value2","value2"}
    };
    }
    @Test(dataProvider = "data")
    public void data02Test(String v1,String v2,String v3){
    System.out.println(a);
    System.out.println(v1+v2+v3);
    }
     
    8.enabled = false, dependsOnGroups, dependsOnMethods,groups
    @Test(dependsOnMethods = "dependsOnMethodsTest01")
     
    9.expectedExceptions ,expectedExceptionsMessageRegExp
    @Test(expectedExceptions = ArithmeticException.class,expectedExceptionsMessageRegExp = "111")

  • 相关阅读:
    Codeforces 1322B
    面向对象案例
    0428面向对象2.0
    0427 面向对象初识
    0427数组相关思想
    0426数组操作
    Eclipse使用技巧
    数组汇总0426
    0424数组练习
    数组习题练习0424
  • 原文地址:https://www.cnblogs.com/xiaowei89426/p/9074110.html
Copyright © 2011-2022 走看看