Java Code Examples for org.testng.ITestContext#getSkippedTests()

The following examples show how to use org.testng.ITestContext#getSkippedTests() . 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 vote down vote up
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: ReporterUtil.java    From qaf with MIT License 6 votes vote down vote up
private static int getSkipCnt(ITestContext context) {
	if ((context != null) && (context.getSkippedTests() != null)) {
		if (context.getSkippedTests().getAllResults() != null) {
			Collection<ITestNGMethod> skippedTest =
					context.getSkippedTests().getAllMethods();
			Set<ITestNGMethod> set = new HashSet<ITestNGMethod>(skippedTest);
			if (ApplicationProperties.RETRY_CNT.getIntVal(0) > 0) {
				set.removeAll(context.getPassedTests().getAllMethods());
				set.removeAll(context.getFailedTests().getAllMethods());
				return set.size();
			}
			return context.getSkippedTests().getAllResults().size();
		}
		return context.getSkippedTests().size();
	}
	return 0;
}
 
Example 3
Source File: TestReport.java    From PatatiumWebUi with Apache License 2.0 5 votes vote down vote up
@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");


}