Java Code Examples for org.testng.ITestContext#getFailedTests()
The following examples show how to use
org.testng.ITestContext#getFailedTests() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QAFTestNGListener.java From qaf with MIT License | 7 votes |
protected void setSkip(ITestResult tr, ITestContext context) { if (getBundle().getInt("testng.version", 6) > 5) { // Fix for testNG 6 if ((null != context.getFailedTests())) { if (((null != context.getFailedTests().getResults(tr.getMethod()))) && (context.getFailedTests().getResults(tr.getMethod()) .size() > 1)) { context.getFailedTests().getResults(tr.getMethod()).remove(tr); } else { context.getFailedTests().removeResult(tr.getMethod()); } } tr.setStatus(ITestResult.SKIP); if (null != context.getSkippedTests()) { context.getSkippedTests().addResult(tr, tr.getMethod()); } } else { tr.setStatus(ITestResult.SKIP); } }
Example 2
Source File: Util.java From cloudbreak with Apache License 2.0 | 7 votes |
public static Measure collectMeasurements(ITestContext iTestContext) { if (iTestContext == null) { throw new IllegalArgumentException("No testng testcontext is given."); } IResultMap failed = iTestContext.getFailedTests(); IResultMap success = iTestContext.getPassedTests(); MeasureAll allMeasurement = new MeasureAll(); failed.getAllResults().stream().forEach( getiTestResultConsumer(allMeasurement) ); success.getAllResults().stream().forEach( getiTestResultConsumer(allMeasurement) ); return allMeasurement; }
Example 3
Source File: QAFTestNGListener.java From qaf with MIT License | 6 votes |
protected void setFailure(ITestResult tr, ITestContext context) { if (getBundle().getInt("testng.version", 6) > 5) { // Fix for testNG 6 // IResultMap resultMap = context.getPassedTests(); // resultMap. if ((null != context.getPassedTests())) { if (context.getPassedTests().getResults(tr.getMethod()).size() > 1) { context.getPassedTests().removeResult(tr); } else { context.getPassedTests().removeResult(tr.getMethod()); } // removeResult(tr.getMethod()); } tr.setStatus(ITestResult.FAILURE); if (null != context.getFailedTests()) { context.getFailedTests().addResult(tr, tr.getMethod()); } } else { tr.setStatus(ITestResult.FAILURE); } }
Example 4
Source File: PowerEmailableReporter.java From WebAndAppUITesting with GNU General Public License v3.0 | 5 votes |
/** * Get All tests id by class + method + parameters hash code. * * @param context * @param suite */ private void getAllTestIds(ITestContext context, ISuite suite) { IResultMap passTests = context.getPassedTests(); IResultMap failTests = context.getFailedTests(); List<IInvokedMethod> invokedMethods = suite.getAllInvokedMethods(); for (IInvokedMethod im : invokedMethods) { if (passTests.getAllMethods().contains(im.getTestMethod()) || failTests.getAllMethods().contains(im.getTestMethod())) { int testId = getId(im.getTestResult()); // m_out.println("ALLtestid=" + testId); allRunTestIds.add(testId); } } }
Example 5
Source File: TestReport.java From PatatiumWebUi with Apache License 2.0 | 5 votes |
@Override public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) { List<ITestResult> list = new ArrayList<ITestResult>(); for (ISuite suite : suites) { Map<String, ISuiteResult> suiteResults = suite.getResults(); for (ISuiteResult suiteResult : suiteResults.values()) { ITestContext testContext = suiteResult.getTestContext(); IResultMap passedTests = testContext.getPassedTests(); IResultMap failedTests = testContext.getFailedTests(); IResultMap skippedTests = testContext.getSkippedTests(); IResultMap failedConfig = testContext.getFailedConfigurations(); list.addAll(this.listTestResult(passedTests)); list.addAll(this.listTestResult(failedTests)); list.addAll(this.listTestResult(skippedTests)); //list.addAll(this.listTestResult(failedConfig)); } } CopyReportResources reportReource=new CopyReportResources(); try { reportReource.copyResources(); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } this.sort(list); this.outputResult(list, outputDirectory+"/report.html"); }
Example 6
Source File: ReporterUtil.java From qaf with MIT License | 5 votes |
private static int getFailCnt(ITestContext context) { if ((context != null) && (context.getFailedTests() != null)) { if (context.getFailedTests().getAllResults() != null) { return context.getFailedTests().getAllResults().size(); } return context.getFailedTests().size(); } return 0; }