Created
February 16, 2017 04:05
-
-
Save krmahadevan/65847122ba41ee485f72ab4e920d4436 to your computer and use it in GitHub Desktop.
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
package com.rationaleemotions.stackoverflow; | |
import org.testng.annotations.Test; | |
public class ChildClassOne extends MyBaseClass { | |
public ChildClassOne() { | |
super(false); | |
} | |
@Test | |
public void testMethod() { | |
System.err.println("Test Method from " + getClass().getName()); | |
} | |
} |
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
package com.rationaleemotions.stackoverflow; | |
import org.testng.annotations.Test; | |
public class ChildClassTwo extends MyBaseClass { | |
public ChildClassTwo() { | |
super(true); | |
} | |
@Test | |
public void testMethod() { | |
System.err.println("Test Method from " + getClass().getName()); | |
} | |
} |
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
package com.rationaleemotions.stackoverflow; | |
import org.testng.annotations.BeforeClass; | |
public class MyBaseClass { | |
protected boolean shouldFail = false; | |
public MyBaseClass(boolean shouldFail) { | |
this.shouldFail = shouldFail; | |
} | |
@BeforeClass | |
public void beforeClass() { | |
if (shouldFail) { | |
throw new IllegalStateException("Un-defined state"); | |
} | |
System.err.println("BeforeClass invoked from " + getClass().getName()); | |
} | |
} |
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
package com.rationaleemotions.stackoverflow; | |
import org.testng.TestNG; | |
import org.testng.xml.XmlSuite; | |
public class TestRunner { | |
public static void main(String[] args) { | |
TestNG tng = new TestNG(); | |
tng.setVerbose(2); | |
tng.setUseDefaultListeners(true); | |
tng.setConfigFailurePolicy(XmlSuite.FailurePolicy.CONTINUE); | |
tng.setTestClasses(new Class[] {ChildClassOne.class, ChildClassTwo.class}); | |
tng.run(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment