在一个类A中,如果要得到类名,可以用 this.getClass().getSimpleName(),但如果在其它类B中,想得到类A的名称,得在A类中得到类名然后再传值给B,这样在类 A中就得增加一些代码,但在使用testng时,测试类中不需要添加任何代码,在其它类中得到测试类名的办法: 一.采用Reporter静态类 @BeforeClass 二. @BeforeClass |
|
来自: liuchangxin81 > 《Selenium》