Skip to content

Commit

Permalink
fix: listener has been updated;
Browse files Browse the repository at this point in the history
  • Loading branch information
smansoft committed Jan 6, 2022
1 parent 7f283f3 commit 0673a15
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions server/src/test/java/io/jans/as/server/JansUnitTestsListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,22 @@ public void onStart(ITestContext context) {
}

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

@Override
public void onTestFailure(ITestResult result) {
Reporter.log("Test FAILED: " + result.getName() + "." + result.getMethod().getMethodName(), true);
Object[] parameters = result.getParameters();
if(parameters != null) {
Reporter.log("Test Parameters: ", true);
for(Object parameter : parameters) {
Reporter.log("parameter = " + parameter, true);
}
}
Throwable throwable = result.getThrowable();
if(throwable != null) {
Reporter.log("", true);
Reporter.log("Exception: ", true);
Reporter.log(Throwables.getStackTraceAsString(result.getThrowable()), true);
Reporter.log("", true);
}
testFailed(result);
Reporter.log("", true);
}

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

@Override
Expand All @@ -61,4 +53,21 @@ public void onTestSuccess(ITestResult result) {
Reporter.log("Test SUCCESS: " + result.getName() + "." + result.getMethod().getMethodName(), true);
Reporter.log("", true);
}

private void testFailed(ITestResult result) {
Object[] parameters = result.getParameters();
if(parameters != null) {
Reporter.log("Test Parameters: ", true);
for(Object parameter : parameters) {
Reporter.log("parameter = " + parameter, true);
}
}
Throwable throwable = result.getThrowable();
if(throwable != null) {
Reporter.log("", true);
Reporter.log("Exception: ", true);
Reporter.log(Throwables.getStackTraceAsString(result.getThrowable()), true);
Reporter.log("", true);
}
}
}

0 comments on commit 0673a15

Please sign in to comment.