zoukankan      html  css  js  c++  java
  • TestNG取得测试类名的方法

    在一个类A中,如果要得到类名,可以用this.getClass().getSimpleName(),但如果在其它类B中,想得到类A的名称,得在A类中得到类名然后再传值给B,这样在类A中就得增加一些代码,但在使用testng时,测试类中不需要添加任何代码,在其它类中得到测试类名的办法:

    一.采用Reporter静态类

        @BeforeClass
        public void getTestClassName(){        
            ITestResult it = Reporter.getCurrentTestResult();            
            System.out.println(it.getTestClass());      
        }

    二.

    @BeforeClass
        public void getTestClassName(){        
            System.out.println(this.getClass().getSimpleName());    
        }

  • 相关阅读:
    hadoop yarn日志分离
    hadoop优化
    hive UDF
    hadoophttpfs
    spark编译
    spark feature
    python
    python 装饰器
    HTML特殊转义字符列表
    博客园数据统计
  • 原文地址:https://www.cnblogs.com/zhangfei/p/2774011.html
Copyright © 2011-2022 走看看