コード例 #1
0
  @Test
  public void testCaseReportRuleStartedTest() throws Exception {
    Description description = mock(Description.class);
    when(description.getAnnotations()).thenReturn(Collections.<Annotation>emptyList());
    when(description.getMethodName()).thenReturn("some.method.name");

    testCaseReportRule.starting(description);
    verify(allure).fire(eq(new TestCaseStartedEvent("some.uid", "some.method.name")));
  }
コード例 #2
0
  @Before
  public void setUp() throws Exception {
    testSuiteReportRule = mock(TestSuiteReportRule.class);
    when(testSuiteReportRule.getUid()).thenReturn("some.uid");
    testCaseReportRule = new TestCaseReportRule(testSuiteReportRule);

    allure = mock(Allure.class);
    testCaseReportRule.setLifecycle(allure);
  }
コード例 #3
0
 @Test
 public void testCaseReportRuleFinishedTest() throws Exception {
   testCaseReportRule.finished(mock(Description.class));
   verify(allure).fire(eq(new TestCaseFinishedEvent()));
 }
コード例 #4
0
 @Test
 public void testCaseReportRuleSkippedTest() throws Exception {
   AssumptionViolatedException throwable = new AssumptionViolatedException("atata");
   testCaseReportRule.skipped(throwable, mock(Description.class));
   verify(allure).fire(eq(new TestCaseSkippedEvent().withThrowable(throwable)));
 }
コード例 #5
0
 @Test
 public void testCaseReportRuleFailedTest() throws Exception {
   Throwable throwable = new Exception("atata");
   testCaseReportRule.failed(throwable, mock(Description.class));
   verify(allure).fire(eq(new TestCaseFailureEvent().withThrowable(throwable)));
 }