Search in sources :

Example 16 with IssueBean

use of com.seleniumtests.connectors.bugtracker.IssueBean in project seleniumRobot by bhecquet.

the class TestBugTracker method testCreateIssueBeanNoEndStep.

/**
 * If no Test end steps are available, do not create IssueBean
 * @throws Exception
 */
@Test(groups = { "ut" })
public void testCreateIssueBeanNoEndStep() throws Exception {
    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", "myTest", "some description", Arrays.asList(step1), issueOptions);
    Assert.assertNull(issueBean);
}
Also used : FakeBugTracker(com.seleniumtests.connectors.bugtracker.FakeBugTracker) IssueBean(com.seleniumtests.connectors.bugtracker.IssueBean) BugTracker(com.seleniumtests.connectors.bugtracker.BugTracker) FakeBugTracker(com.seleniumtests.connectors.bugtracker.FakeBugTracker) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 17 with IssueBean

use of com.seleniumtests.connectors.bugtracker.IssueBean in project seleniumRobot by bhecquet.

the class TestBugTracker method testDoNotCreateIssueBeanWithStepDisabled.

/**
 * Test that if the failed step disables bugtracker, the issue bean is not created
 * @throws Exception
 */
@Test(groups = { "ut" })
public void testDoNotCreateIssueBeanWithStepDisabled() throws Exception {
    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", "testDoNotCreateIssueBeanWithStepDisabled", "some description", Arrays.asList(step1, stepFailedWithDisabledBugtracker, stepEnd), issueOptions);
    Assert.assertNull(issueBean);
}
Also used : FakeBugTracker(com.seleniumtests.connectors.bugtracker.FakeBugTracker) IssueBean(com.seleniumtests.connectors.bugtracker.IssueBean) BugTracker(com.seleniumtests.connectors.bugtracker.BugTracker) FakeBugTracker(com.seleniumtests.connectors.bugtracker.FakeBugTracker) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 18 with IssueBean

use of com.seleniumtests.connectors.bugtracker.IssueBean in project seleniumRobot by bhecquet.

the class TestJiraConnector method testCreateJiraBeanWithErrorCauseAndDetails.

@Test(groups = { "ut" })
public void testCreateJiraBeanWithErrorCauseAndDetails() throws Exception {
    jiraOptions.put("priority", "P1");
    jiraOptions.put("assignee", "me");
    jiraOptions.put("reporter", "you");
    jiraOptions.put("jira.issueType", "Bug");
    jiraOptions.put("jira.components", "comp1,comp2");
    jiraOptions.put("jira.field.foo", "bar");
    SeleniumTestsContextManager.getThreadContext().setStartedBy("http://foo/bar/job/1");
    JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
    IssueBean issueBean = jiraConnector.createIssueBean("[Selenium][selenium][DEV][ngName] test myTest KO", "testCreateJiraBean", "some description", Arrays.asList(step1, stepWithErrorCauseAndDetails, stepEnd), jiraOptions);
    Assert.assertTrue(issueBean instanceof JiraBean);
    JiraBean jiraBean = (JiraBean) issueBean;
    // check only step2 is seen as a failed step
    // detailed result is not provided because 'startedBy' is set
    Assert.assertEquals(jiraBean.getDescription(), "*Test:* testCreateJiraBean\n" + "*Description:* some description\n" + "*Started by:* http://foo/bar/job/1\n" + "*Error step #1 (step 3):* *{color:#de350b}java.lang.NullPointerException: Error clicking{color}*\n" + "h2. Steps in error\n" + "* *Step 1: step 3*\n" + "+Possible cause:+ REGRESSION => Check  your script\n" + "{code:java}Step step 3\n" + "  - action1\n" + "  - action2{code}\n" + "\n" + "h2. Last logs\n" + "{code:java}Step Test end{code}\n" + "\n" + "h2. Associated screenshots\n" + "!N-A_0-2_Test_end--123456.png|thumbnail!\n" + "!N-A_0-2_Test_end--123456.png|thumbnail!\n");
}
Also used : IssueBean(com.seleniumtests.connectors.bugtracker.IssueBean) JiraBean(com.seleniumtests.connectors.bugtracker.jira.JiraBean) JiraConnector(com.seleniumtests.connectors.bugtracker.jira.JiraConnector) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

IssueBean (com.seleniumtests.connectors.bugtracker.IssueBean)18 MockitoTest (com.seleniumtests.MockitoTest)16 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)16 Test (org.testng.annotations.Test)16 BugTracker (com.seleniumtests.connectors.bugtracker.BugTracker)9 JiraConnector (com.seleniumtests.connectors.bugtracker.jira.JiraConnector)9 FakeBugTracker (com.seleniumtests.connectors.bugtracker.FakeBugTracker)7 JiraBean (com.seleniumtests.connectors.bugtracker.jira.JiraBean)6 SearchResult (com.atlassian.jira.rest.client.api.domain.SearchResult)3 TestStep (com.seleniumtests.reporter.logger.TestStep)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 IssueRestClient (com.atlassian.jira.rest.client.api.IssueRestClient)1 JiraRestClient (com.atlassian.jira.rest.client.api.JiraRestClient)1 RestClientException (com.atlassian.jira.rest.client.api.RestClientException)1 SearchRestClient (com.atlassian.jira.rest.client.api.SearchRestClient)1 BasicComponent (com.atlassian.jira.rest.client.api.domain.BasicComponent)1 BasicIssue (com.atlassian.jira.rest.client.api.domain.BasicIssue)1 BasicPriority (com.atlassian.jira.rest.client.api.domain.BasicPriority)1 BasicProject (com.atlassian.jira.rest.client.api.domain.BasicProject)1