-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: data_provider, multiplying redundant calls of u test functions, …
…listener has been added;
- Loading branch information
Showing
4 changed files
with
147 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
64 changes: 64 additions & 0 deletions
64
server/src/test/java/io/jans/as/server/JansUnitTestsTestsListener.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* | ||
*/ | ||
package io.jans.as.server; | ||
|
||
import org.testng.ITestContext; | ||
import org.testng.ITestListener; | ||
import org.testng.ITestResult; | ||
import org.testng.Reporter; | ||
|
||
import com.google.common.base.Throwables; | ||
|
||
/** | ||
* @author Sergey Manoylo | ||
* @version December 29, 2021 | ||
*/ | ||
public class JansUnitTestsTestsListener implements ITestListener { | ||
|
||
@Override | ||
public void onFinish(ITestContext context) { | ||
} | ||
|
||
@Override | ||
public void onStart(ITestContext context) { | ||
} | ||
|
||
@Override | ||
public void onTestFailedButWithinSuccessPercentage(ITestResult context) { | ||
} | ||
|
||
@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); | ||
} | ||
} | ||
|
||
@Override | ||
public void onTestSkipped(ITestResult result) { | ||
} | ||
|
||
@Override | ||
public void onTestStart(ITestResult result) { | ||
Reporter.log("Test STARTED: " + result.getName() + "." + result.getMethod().getMethodName(), true); | ||
} | ||
|
||
@Override | ||
public void onTestSuccess(ITestResult result) { | ||
Reporter.log("Test SUCCESS: " + result.getName() + "." + result.getMethod().getMethodName(), true); | ||
Reporter.log("", true); | ||
} | ||
} |
This file contains 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
This file contains 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