Suppose I have a JUnit unit test, which has two parts, and I donβt want to separate them into separate @Test methods. Suppose also that I want a timeout parameter for a test.
How can I change / intercept / control a timeout approval error message to indicate which part of the test has been crossed out?
Here's an attempt that doesn't work:
@Test(timeout = 1000) public void test() { try { // part one of the test } catch (Throwable e) { Assert.fail("Part one failed"); } try { // part two of the test } catch (Throwable e) { Assert.fail("Part two failed"); } }
source share