Java 类org.testng.internal.ResultMap 实例源码

项目:agent-java-testNG    文件:BuildTestTest.java   
@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));
}
项目:agent-java-testNG    文件:BuildTestTest.java   
@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));
}
项目:agent-java-testNG    文件:BuildTestTest.java   
@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));
}
项目:agent-java-testNG    文件:BuildTestTest.java   
@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));
}
项目:agent-java-testNG    文件:BuildTestTest.java   
@Test
public void testFinishTestRqPassed() {
    ResultMap empty = new ResultMap();
    Date endTime = new Date(DEFAULT_TIME);
    when(testContext.getEndDate()).thenReturn(endTime);
    when(testContext.getFailedTests()).thenReturn(empty);
    when(testContext.getFailedConfigurations()).thenReturn(empty);
    when(testContext.getSkippedTests()).thenReturn(empty);
    when(testContext.getSkippedConfigurations()).thenReturn(empty);

    FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
    assertThat("Incorrect end time", rq.getEndTime(), is(endTime));
    assertThat("Incorrect status", rq.getStatus(), is(Statuses.PASSED));
}
项目:agent-java-testNG    文件:BuildTestTest.java   
@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));
}
项目:agent-java-testNG    文件:TestNGServiceTest.java   
@Test
public void finishTest() {
    ResultMap empty = new ResultMap();
    when(testContext.getFailedTests()).thenReturn(empty);
    when(testContext.getFailedConfigurations()).thenReturn(empty);
    when(testContext.getSkippedConfigurations()).thenReturn(empty);
    when(testContext.getSkippedTests()).thenReturn(empty);

    testNGService.finishTest(testContext);
    verify(launch, times(1)).finishTestItem(eq(id), any(FinishTestItemRQ.class));
}
项目:seleniumtestsframework    文件:SeleniumTestsReporter.java   
public void onStart(final ITestContext arg0) {
    isRetryHandleNeeded.put(arg0.getName(), false);
    failedTests.put(arg0.getName(), new ResultMap());
    skippedTests.put(arg0.getName(), new ResultMap());
}