Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何获取运行给定测试的类名。要获取测试的名称,我使用@Rule TestName。
但是,如果我想要测试课,我该如何获得呢?
只需使用
this.getClass().getName()
或者
this.getClass().getSimpleName()
取决于您是想要带有包的全名还是只是简单的类名。