1

我正在尝试获取当前正在执行的运行器类的名称,例如:

@RunWith(Cucumber.class)
@CucumberOptions(
features={"Features"},
glue={"src.stepdefinition"},
monochrome=false
)
public class HelloWorld {
}

我需要在我的 java 代码中使用类名“HelloWorld”。有人知道如何获得吗?我已经尝试过这个:http: //ramblingsofaswtester.com/2013/04/15/cucumber-test-name-and-tags-on-feature/ 这绝对是正确的方向,但它不包含跑步者类名。

编辑:因为我使用 Maven 我可以访问

System.getProperty("test")

其中包含带有类名的包名。

4

0 回答 0