Created
June 13, 2017 12:55
-
-
Save krmahadevan/fa7ab905b09f84206d7c4af0c10e9d8c to your computer and use it in GitHub Desktop.
Sample code for https://stackoverflow.com/q/44518748/679824
This file contains hidden or 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
... | |
... TestNG 6.11 by Cédric Beust ([email protected]) | |
... | |
Executing : com.rationaleemotions.stackoverflow.qn44518748.SampleClassOne.testMethodA() on thread [ 11] | |
Executing : com.rationaleemotions.stackoverflow.qn44518748.SampleClassTwo.testMethodA() on thread [ 11] | |
Executing : com.rationaleemotions.stackoverflow.qn44518748.SampleClassOne.testMethodB() on thread [ 11] | |
Executing : com.rationaleemotions.stackoverflow.qn44518748.SampleClassTwo.testMethodB() on thread [ 11] | |
Executing : com.rationaleemotions.stackoverflow.qn44518748.SampleClassOne.testMethodC() on thread [ 11] | |
Executing : com.rationaleemotions.stackoverflow.qn44518748.SampleClassTwo.testMethodC() on thread [ 11] | |
=============================================== | |
1265_Suite | |
Total tests run: 6, Failures: 0, Skips: 0 | |
=============================================== |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> | |
<suite name="1265_Suite" parallel="false" verbose="2"> | |
<test name="92" parallel="classes" thread-count="1"> | |
<packages> | |
<package name="com.rationaleemotions.stackoverflow.qn44518748"/> | |
</packages> | |
</test> | |
</suite> |
This file contains hidden or 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.qn44518748; | |
import org.testng.Reporter; | |
import org.testng.annotations.Test; | |
public class SampleClassOne { | |
@Test | |
public void testMethodA() { | |
Reporter.log("Executing : " + output(), true); | |
} | |
@Test(dependsOnMethods = "testMethodA") | |
public void testMethodB() { | |
Reporter.log("Executing : " + output(), true); | |
} | |
@Test(dependsOnMethods = "testMethodB") | |
public void testMethodC() { | |
Reporter.log("Executing : " + output(), true); | |
} | |
private String output() { | |
String clazzName = getClass().getCanonicalName(); | |
String method = Reporter.getCurrentTestResult().getMethod().getMethodName(); | |
return clazzName + "." + method + "() on thread [ " + Thread.currentThread().getId() + "]"; | |
} | |
} |
This file contains hidden or 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.qn44518748; | |
import org.testng.Reporter; | |
import org.testng.annotations.Test; | |
public class SampleClassTwo { | |
@Test | |
public void testMethodA() { | |
Reporter.log("Executing : " + output(), true); | |
} | |
@Test(dependsOnMethods = "testMethodA") | |
public void testMethodB() { | |
Reporter.log("Executing : " + output(), true); | |
} | |
@Test(dependsOnMethods = "testMethodB") | |
public void testMethodC() { | |
Reporter.log("Executing : " + output(), true); | |
} | |
private String output() { | |
String clazzName = getClass().getCanonicalName(); | |
String method = Reporter.getCurrentTestResult().getMethod().getMethodName(); | |
return clazzName + "." + method + "() on thread [ " + Thread.currentThread().getId() + "]"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment