Skip to content

Instantly share code, notes, and snippets.

@krmahadevan
Created February 14, 2018 18:13
Show Gist options
  • Save krmahadevan/24a907ac550fb9b190efffcbdd148656 to your computer and use it in GitHub Desktop.
Save krmahadevan/24a907ac550fb9b190efffcbdd148656 to your computer and use it in GitHub Desktop.
package com.rationaleemotions.stackoverflow.qn48792353;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
public class Base {
@BeforeSuite
public void beforeSuite() {
System.err.println("beforeSuite() invoked");
}
@AfterSuite
public void afterSuite() {
System.err.println("afterSuite() invoked");
}
}
package com.rationaleemotions.stackoverflow.qn48792353;
import org.testng.annotations.Test;
public class Four extends Base {
@Test
public void test4() {
System.err.println("test4() executed");
}
}
package com.rationaleemotions.stackoverflow.qn48792353;
import org.testng.annotations.Test;
public class One extends Base {
@Test
public void test1() {
System.err.println("test1() executed");
}
}
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ testbed ---
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
...
... TestNG 6.14.2 by Cédric Beust ([email protected])
...
beforeSuite() invoked
test1() executed
test2() executed
test3() executed
test4() executed
afterSuite() invoked
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.458 sec - in TestSuite
Results :
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="48792353_Suite" verbose="2">
<test name="48792353_test">
<classes>
<class name="com.rationaleemotions.stackoverflow.qn48792353.One"/>
<class name="com.rationaleemotions.stackoverflow.qn48792353.Two"/>
<class name="com.rationaleemotions.stackoverflow.qn48792353.Three"/>
<class name="com.rationaleemotions.stackoverflow.qn48792353.Four"/>
</classes>
</test>
</suite>
package com.rationaleemotions.stackoverflow.qn48792353;
import org.testng.annotations.Test;
public class Three extends Base {
@Test
public void test3() {
System.err.println("test3() executed");
}
}
package com.rationaleemotions.stackoverflow.qn48792353;
import org.testng.annotations.Test;
public class Two extends Base {
@Test
public void test2() {
System.err.println("test2() executed");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment