forked from Zakaria/testNG
ITestListeners
This commit is contained in:
parent
d3b4d34d72
commit
0ea536fcfa
54
src/test/java/zacksolutions/Listeners.java
Normal file
54
src/test/java/zacksolutions/Listeners.java
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package zacksolutions;
|
||||||
|
|
||||||
|
|
||||||
|
import org.testng.ITestContext;
|
||||||
|
import org.testng.ITestListener;
|
||||||
|
import org.testng.ITestResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listeners
|
||||||
|
*/
|
||||||
|
public class Listeners implements ITestListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTestStart(ITestResult result) {
|
||||||
|
ITestListener.super.onTestStart(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTestSuccess(ITestResult result) {
|
||||||
|
ITestListener.super.onTestSuccess(result);
|
||||||
|
System.out.println("MSG from Listeners Class");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTestFailure(ITestResult result) {
|
||||||
|
ITestListener.super.onTestFailure(result);
|
||||||
|
System.out.println("This test was purposlly set to fail for testing reasons " + result.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTestSkipped(ITestResult result) {
|
||||||
|
ITestListener.super.onTestSkipped(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
|
||||||
|
ITestListener.super.onTestFailedButWithinSuccessPercentage(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTestFailedWithTimeout(ITestResult result) {
|
||||||
|
ITestListener.super.onTestFailedWithTimeout(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish(ITestContext context) {
|
||||||
|
ITestListener.super.onFinish(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart(ITestContext context) {
|
||||||
|
ITestListener.super.onStart(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package zacksolutions;
|
package zacksolutions;
|
||||||
|
|
||||||
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestNGDiffClass {
|
public class TestNGDiffClass {
|
||||||
@ -26,5 +27,6 @@ public class TestNGDiffClass {
|
|||||||
@Test(groups = { "Smoke" })
|
@Test(groups = { "Smoke" })
|
||||||
public static void testCaseTen() {
|
public static void testCaseTen() {
|
||||||
System.out.println("Debug the tenth case");
|
System.out.println("Debug the tenth case");
|
||||||
|
Assert.assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
||||||
<suite name="All Test Suite">
|
<suite name="All Test Suite">
|
||||||
|
<listeners>
|
||||||
|
<listener class-name="zacksolutions.Listeners"></listener>
|
||||||
|
</listeners>
|
||||||
<parameter name="URL" value="zacksolutions.dev"/>
|
<parameter name="URL" value="zacksolutions.dev"/>
|
||||||
<test name="RegressionTest">
|
<test name="RegressionTest">
|
||||||
<groups>
|
<groups>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user