The
TestName Rule makes the current test name available inside test method.
TestApp.java
Find
the below working application.
package com.sample.test; import static org.junit.Assert.assertEquals; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; public class TestApp { @Rule public TestName testName = new TestName(); @Test public void testCase1() { assertEquals("testCase1", testName.getMethodName()); } @Test public void testCase2() { assertEquals("testCase2", testName.getMethodName()); } }
No comments:
Post a Comment