I learned how to figure out the test method name of a JUnit test class.
You can use it to grasp the test case with @Before
.
Information can be obtained by adding @ org.junit.Rule
to ʻorg.junit.rules.TestName` and defining the fields of the test class.
/**
* TestName
*/
@Rule
public TestName testName = new TestName();
// want to know test case name.
System.out.println("[TestName] : " + testName.getMethodName());
It's convenient, I would like to use it from now on. For your reference.
Recommended Posts