当前位置: 首页>>代码示例>>Java>>正文


Java IResultMap类代码示例

本文整理汇总了Java中org.testng.IResultMap的典型用法代码示例。如果您正苦于以下问题:Java IResultMap类的具体用法?Java IResultMap怎么用?Java IResultMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IResultMap类属于org.testng包,在下文中一共展示了IResultMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateReport

import org.testng.IResultMap; //导入依赖的package包/类
@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));
        }          
    }
    this.sort(list);
    this.outputResult(list, outputDirectory+"/test.txt");
}
 
开发者ID:pcsh,项目名称:cashion,代码行数:21,代码来源:IReporterNewReport.java

示例2: testFinishHasFailedTests

import org.testng.IResultMap; //导入依赖的package包/类
@Test
public void testFinishHasFailedTests() {
	IResultMap failedTests = mock(IResultMap.class);

	ResultMap empty = new ResultMap();

	when(testContext.getFailedConfigurations()).thenReturn(empty);
	when(testContext.getSkippedTests()).thenReturn(empty);
	when(testContext.getSkippedConfigurations()).thenReturn(empty);

	when(failedTests.size()).thenReturn(1);
	when(testContext.getFailedTests()).thenReturn(failedTests);

	FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
	assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
}
 
开发者ID:reportportal,项目名称:agent-java-testNG,代码行数:17,代码来源:BuildTestTest.java

示例3: testFinishHasFailedConfigurations

import org.testng.IResultMap; //导入依赖的package包/类
@Test
public void testFinishHasFailedConfigurations() {
	IResultMap failedConfigurations = mock(IResultMap.class);

	ResultMap empty = new ResultMap();

	when(testContext.getFailedTests()).thenReturn(empty);
	when(testContext.getSkippedTests()).thenReturn(empty);
	when(testContext.getSkippedConfigurations()).thenReturn(empty);

	when(failedConfigurations.size()).thenReturn(1);
	when(testContext.getFailedConfigurations()).thenReturn(failedConfigurations);

	FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
	assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
}
 
开发者ID:reportportal,项目名称:agent-java-testNG,代码行数:17,代码来源:BuildTestTest.java

示例4: testFinishHasSkippedTest

import org.testng.IResultMap; //导入依赖的package包/类
@Test
public void testFinishHasSkippedTest() {
	IResultMap skippedTests = mock(IResultMap.class);

	ResultMap empty = new ResultMap();

	when(testContext.getFailedTests()).thenReturn(empty);
	when(testContext.getFailedConfigurations()).thenReturn(empty);
	when(testContext.getSkippedConfigurations()).thenReturn(empty);

	when(skippedTests.size()).thenReturn(1);
	when(testContext.getSkippedTests()).thenReturn(skippedTests);

	FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
	assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
}
 
开发者ID:reportportal,项目名称:agent-java-testNG,代码行数:17,代码来源:BuildTestTest.java

示例5: testFinishHasSkippedConfigurationsTest

import org.testng.IResultMap; //导入依赖的package包/类
@Test
public void testFinishHasSkippedConfigurationsTest() {
	IResultMap skippedConfigurations = mock(IResultMap.class);

	ResultMap empty = new ResultMap();

	when(testContext.getFailedTests()).thenReturn(empty);
	when(testContext.getFailedConfigurations()).thenReturn(empty);
	when(testContext.getSkippedTests()).thenReturn(empty);

	when(skippedConfigurations.size()).thenReturn(1);
	when(testContext.getSkippedConfigurations()).thenReturn(skippedConfigurations);

	FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
	assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
}
 
开发者ID:reportportal,项目名称:agent-java-testNG,代码行数:17,代码来源:BuildTestTest.java

示例6: onFinish

import org.testng.IResultMap; //导入依赖的package包/类
@Override
public void onFinish(ITestContext context) {
    final ISuite suite = context.getSuite();
    final String suiteName = suite == null ? "[UNKNOWN]" : suite.getName();

    final IResultMap passed = context.getPassedTests();
    final IResultMap failed = context.getFailedTests();
    final IResultMap skipped = context.getSkippedTests();

    final int passedCount = passed == null ? -1 : passed.size();
    final int failedCount = failed == null ? -1 : failed.size();
    final int skippedCount = skipped == null ? -1 : skipped.size();

    Log.i(TAG, "Finished test run \"" + suiteName + "\" with "
               + passedCount + " successful tests, "
               + failedCount + " failures and "
               + skippedCount + " tests skipped");
}
 
开发者ID:LemonadeLabInc,项目名称:android-testng,代码行数:19,代码来源:TestNGLogger.java

示例7: addAllTestResults

import org.testng.IResultMap; //导入依赖的package包/类
private void addAllTestResults(Set<ITestResult> testResults, IResultMap resultMap) {
  if (resultMap != null) {
    // Sort the results chronologically before adding them
    List<ITestResult> allResults = new ArrayList<ITestResult>();
    allResults.addAll(resultMap.getAllResults());

    Collections.sort(new ArrayList<>(allResults), new Comparator<ITestResult>() {
      @Override
      public int compare(ITestResult o1, ITestResult o2) {
        return (int) (o1.getStartMillis() - o2.getStartMillis());
      }
    });

    testResults.addAll(allResults);
  }
}
 
开发者ID:bigtester,项目名称:automation-test-engine,代码行数:17,代码来源:ATEXMLSuiteResultWriter.java

示例8: resultDetail

import org.testng.IResultMap; //导入依赖的package包/类
private void resultDetail(IResultMap tests) {
	for (ITestResult result : tests.getAllResults()) {
		ITestNGMethod method = result.getMethod();

		int methodId = getId(result);

		String cname = method.getTestClass().getName();
		m_out.println("<h2 id=\"m" + methodId + "\" name=\"m" + methodId + "\" >" + cname + ":"
				+ method.getMethodName() + "</h2>");
		Set<ITestResult> resultSet = tests.getResults(method);
		generateForResult(result, method, resultSet.size());
		m_out.println("<p class=\"totop\"><a href=\"#summary\">back to summary</a></p>");

	}
}
 
开发者ID:quanqinle,项目名称:WebAndAppUITesting,代码行数:16,代码来源:PowerEmailableReporter.java

示例9: getAllTestIds

import org.testng.IResultMap; //导入依赖的package包/类
/**
 * 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);
		}
	}
}
 
开发者ID:quanqinle,项目名称:WebAndAppUITesting,代码行数:20,代码来源:PowerEmailableReporter.java

示例10: getMethodSet

import org.testng.IResultMap; //导入依赖的package包/类
/**
 * @param tests
 * @return
 */
private Collection<ITestNGMethod> getMethodSet(IResultMap tests)
{
    Set r = new TreeSet<ITestNGMethod>(new TestSorter<ITestNGMethod>());
    r.addAll(tests.getAllMethods());
    return r;
}
 
开发者ID:basavaraj1985,项目名称:DolphinNG,代码行数:11,代码来源:EmailableReporter.java

示例11: generateReport

import org.testng.IResultMap; //导入依赖的package包/类
@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");


}
 
开发者ID:zhengshuheng,项目名称:PatatiumWebUi,代码行数:32,代码来源:TestReport.java

示例12: testFinishSuiteFailed

import org.testng.IResultMap; //导入依赖的package包/类
@Test
public void testFinishSuiteFailed() {
	ISuiteResult suiteResult = mock(ISuiteResult.class);
	Map<String, ISuiteResult> suiteResults = new HashMap<String, ISuiteResult>(1);
	suiteResults.put("", suiteResult);
	IResultMap resultMap = mock(ResultMap.class);

	when(iSuite.getResults()).thenReturn(suiteResults);
	when(suiteResult.getTestContext()).thenReturn(testContext);
	when(testContext.getFailedTests()).thenReturn(resultMap);
	when(resultMap.size()).thenReturn(1);

	FinishTestItemRQ rq = testNGService.buildFinishTestSuiteRq(iSuite);
	assertThat(rq.getStatus(), is(Statuses.FAILED));
}
 
开发者ID:reportportal,项目名称:agent-java-testNG,代码行数:16,代码来源:BuildTestTest.java

示例13: resultDetail

import org.testng.IResultMap; //导入依赖的package包/类
private void resultDetail(IResultMap tests) {
	for (ITestResult result : tests.getAllResults()) {
		ITestNGMethod method = result.getMethod();

		int methodId = getId(result);
		
		String cname = method.getTestClass().getName();
		m_out.println("<h2 id=\"m" + methodId + "\" name=\"m" + methodId + "\" >" + cname + ":" + method.getMethodName() + "</h2>");
		Set<ITestResult> resultSet = tests.getResults(method);
		generateForResult(result, method, resultSet.size());
		m_out.println("<p class=\"totop\"><a href=\"#summary\">back to summary</a></p>");

	}
}
 
开发者ID:HarrisChu,项目名称:webUIAuto,代码行数:15,代码来源:PowerEmailableReporter.java

示例14: getAllTestIds

import org.testng.IResultMap; //导入依赖的package包/类
/**
 * 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);
		}
	}
}
 
开发者ID:HarrisChu,项目名称:webUIAuto,代码行数:18,代码来源:PowerEmailableReporter.java

示例15: hasFailedBefore

import org.testng.IResultMap; //导入依赖的package包/类
private boolean hasFailedBefore(IResultMap failureList, ITestResult passedResult) {
  for (ITestResult result : failureList.getAllResults()) {
    String failedTest =
        result.getMethod().getRealClass().toString()+ "." + result.getMethod().getMethodName();
    String passedTest = passedResult.getMethod().getRealClass().toString() + "." +
        passedResult.getMethod().getMethodName();
    
    if (failedTest.equals(passedTest) && methodParameterEqual(result, passedResult)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:web-auto,项目名称:wtf-core,代码行数:14,代码来源:BaseListener.java


注:本文中的org.testng.IResultMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。