首页 > 其他 > 详细

TestNG如何取得测试类名

时间:2014-07-22 22:35:45      阅读:345      评论:0      收藏:0      [点我收藏+]

在A类中,如果要得到类名,可以用this.getClass().getSimpleName()或者使用this.getClass().getName(),通过以下方法区别这两个方法

package com.cn.plant;

public class tree {   
  @Test
public void getClassName(){ String strName=this.getClass().getName(); System.out.println("getName输出结果:"+strName); String strSimpleName=this.getClass().getSimpleName(); System.out.println("getSimpleName输出结果:"+strSimpleName); } }

 

Console端输出结果如下:

getName输出结果:com.cn.plant.tree
getSimpleName输出结果:tree

TestNG如何取得测试类名,布布扣,bubuko.com

TestNG如何取得测试类名

原文:http://www.cnblogs.com/sylvia-liu/p/3860894.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!