Created
May 15, 2018 23:45
-
-
Save jasonrobot/f395a0fe476baa07bc4c79f6391ac3f3 to your computer and use it in GitHub Desktop.
Z runs, Y runs and fails, X skips, W goes anyways, but after Y.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestTestDeps | |
{ | |
@Test(alwaysRun = true) | |
public void testZ() | |
{ | |
System.out.println("z is running"); | |
assertEquals(1, 1); | |
} | |
@Test(dependsOnMethods = "testZ") | |
public void testY() | |
{ | |
System.out.println("y is running"); | |
assertEquals(1, 2); | |
} | |
@Test(dependsOnMethods = "testY") | |
public void testX() | |
{ | |
System.out.println("x is running"); | |
assertEquals(2, 2); | |
} | |
@Test(dependsOnMethods = "testY", alwaysRun = true) | |
public void testW() | |
{ | |
System.out.println("w is running"); | |
assertEquals(3, 3); | |
} | |
// Results: | |
// | |
// z is running | |
// y is running | |
// | |
// java.lang.AssertionError: expected [2] but found [1] | |
// Expected :2 | |
// Actual :1 | |
// <Click to see difference> | |
// | |
// w is running | |
// | |
// Test ignored. <--- That's testX getting skipped | |
// | |
// =============================================== | |
// Default Suite | |
// Total tests run: 4, Failures: 1, Skips: 1 | |
// =============================================== | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment