use of com.seleniumtests.reporter.reporters.SeleniumTestsReporter2 in project seleniumRobot by bhecquet.
the class TestBugTracker method testCreateIssueBean.
/**
* Create a new issue bean
* @throws Exception
*/
@Test(groups = { "ut" })
public void testCreateIssueBean() throws Exception {
// copy resources so that we can be sure something has been copied to zip file
new SeleniumTestsReporter2().copyResources();
FakeBugTracker fbt = spy(new FakeBugTracker());
PowerMockito.whenNew(FakeBugTracker.class).withAnyArguments().thenReturn(fbt);
BugTracker bugtracker = BugTracker.getInstance("fake", "http://foo/bar", "selenium", "user", "password", new HashMap<>());
IssueBean issueBean = bugtracker.createIssueBean("[Selenium][selenium][DEV][ngName] test myTest KO", "testCreateIssueBean", "some description", Arrays.asList(step1, step2, stepEnd), issueOptions);
Assert.assertEquals(issueBean.getAssignee(), "me");
Assert.assertEquals(issueBean.getDescription(), "Test: testCreateIssueBean\n" + "Description: some description\n" + "Error step 1 (step 2): java.lang.NullPointerException: Error clicking\n" + "\n" + "Steps in error\n" + "Step 1: step 2\n" + "------------------------------------\n" + "Step step 2\n" + " - action1\n" + " - action2\n" + "\n" + "Last logs\n" + "Step Test end\n" + "\n" + "For more details, see attached .zip file");
Assert.assertEquals(issueBean.getSummary(), "[Selenium][selenium][DEV][ngName] test myTest KO");
Assert.assertEquals(issueBean.getReporter(), "you");
Assert.assertEquals(issueBean.getTestName(), "testCreateIssueBean");
// screenshots from the last step
Assert.assertEquals(issueBean.getScreenShots(), Arrays.asList(screenshot, screenshot));
// we take the last failing step (not Test end)
Assert.assertEquals(issueBean.getTestStep(), step2);
Assert.assertEquals(issueBean.getDateTime().getDayOfMonth(), ZonedDateTime.now().plusHours(3).getDayOfMonth());
Assert.assertTrue(issueBean.getDetailedResult().isFile());
Assert.assertEquals(issueBean.getDetailedResult().getName(), "detailedResult.zip");
Assert.assertTrue(issueBean.getDetailedResult().length() > 900000);
// not initialized by default
Assert.assertNull(issueBean.getId());
}
Aggregations