Skip to content

Commit

Permalink
fix: listener has been updated #1595;
Browse files Browse the repository at this point in the history
  • Loading branch information
smansoft committed Jan 9, 2022
1 parent 8818dbc commit 21b8f56
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions server/src/test/java/io/jans/as/server/JansUnitTestsListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,40 @@
public class JansUnitTestsListener implements ITestListener {

@Override
public void onFinish(ITestContext context) {
public void onTestStart(ITestResult result) {
Reporter.log("Test STARTED: " + getTestInfo(result), true);
}

@Override
public void onStart(ITestContext context) {
public void onTestSuccess(ITestResult result) {
Reporter.log("Test SUCCESS: " + getTestInfo(result), true);
Reporter.log("", true);
}

@Override
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
Reporter.log("Test FAILED with Success Percentage: " + result.getName() + "." + result.getMethod().getMethodName(), true);
public void onTestFailure(ITestResult result) {
Reporter.log("Test FAILED: " + getTestInfo(result), true);
testFailed(result);
}

@Override
public void onTestFailure(ITestResult result) {
Reporter.log("Test FAILED: " + result.getName() + "." + result.getMethod().getMethodName(), true);
testFailed(result);
Reporter.log("", true);
public void onTestSkipped(ITestResult result) {
Reporter.log("Test SKIPPED: " + getTestInfo(result), true);
Reporter.log("", true);
}

@Override
public void onTestSkipped(ITestResult result) {
Reporter.log("Test SKIPPED: " + result.getName() + "." + result.getMethod().getMethodName(), true);
Reporter.log("", true);
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
Reporter.log("Test FAILED with Success Percentage: " + getTestInfo(result), true);
testFailed(result);
}

@Override
public void onTestStart(ITestResult result) {
Reporter.log("Test STARTED: " + result.getName() + "." + result.getMethod().getMethodName(), true);
public void onStart(ITestContext context) {
}

@Override
public void onTestSuccess(ITestResult result) {
Reporter.log("Test SUCCESS: " + result.getName() + "." + result.getMethod().getMethodName(), true);
Reporter.log("", true);
public void onFinish(ITestContext context) {
}

private void testFailed(ITestResult result) {
Expand All @@ -70,4 +69,16 @@ private void testFailed(ITestResult result) {
Reporter.log("", true);
}
}

private String getTestInfo(ITestResult result) {
String testInfo = null;
if(result.getClass() != null && result.getMethod() != null) {
testInfo = result.getClass().getName() + "." + result.getMethod().getMethodName();
}
else {
testInfo = result.getName();
}
return testInfo;
}

}

0 comments on commit 21b8f56

Please sign in to comment.