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

The following examples show how to use org.testng.ITestContext#getFailedConfigurations() . 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: 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");


}
 
Example 2
Source File: ListenerCommon.java    From stevia with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected int findFailed(ITestContext context) {
	IResultMap failedConfigurations = context.getFailedConfigurations();
	IResultMap skippedConfigurations = context.getSkippedConfigurations();
	
	int countfailed = 0;
	if (failedConfigurations!= null) {
		countfailed += failedConfigurations.size();
	}
	if (skippedConfigurations != null) {
		countfailed += skippedConfigurations.size();
	}
	return countfailed;
}