@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"))); }
@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); }
@Test public void testCaseReportRuleFinishedTest() throws Exception { testCaseReportRule.finished(mock(Description.class)); verify(allure).fire(eq(new TestCaseFinishedEvent())); }
@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))); }
@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))); }