use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestBugTracker method testJiraBugtracker.
@Test(groups = { "ut" })
public void testJiraBugtracker() throws Exception {
PowerMockito.whenNew(JiraConnector.class).withAnyArguments().thenReturn(jiraConnector);
BugTracker bugtracker = BugTracker.getInstance("jira", "http://foo/bar", "selenium", "user", "password", new HashMap<>());
Assert.assertTrue(bugtracker instanceof JiraConnector);
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testCreateIssueWithMinimalFields.
/**
* Test issue creation without fields, components, screenshots, ...
* @throws URISyntaxException
*/
@Test(groups = { "ut" })
public void testCreateIssueWithMinimalFields() throws URISyntaxException {
ArgumentCaptor<IssueInput> issueArgument = ArgumentCaptor.forClass(IssueInput.class);
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", "P1", "Bug", null, null, null, null, new ArrayList<>(), null, new HashMap<>(), new ArrayList<>());
jiraConnector.createIssue(jiraBean);
verify(issueRestClient).createIssue(issueArgument.capture());
// check issue has only mandatory fields
IssueInput issueInput = ((IssueInput) issueArgument.getValue());
Assert.assertEquals(issueInput.getField("summary").getValue(), "issue 1");
Assert.assertEquals(issueInput.getField("description").getValue(), "issue 1 descr");
Assert.assertEquals(((ComplexIssueInputFieldValue) (issueInput.getField("issuetype").getValue())).getValuesMap().get("id"), "1");
Assert.assertEquals(ImmutableList.copyOf(((Iterable<ComplexIssueInputFieldValue>) (issueInput.getField("components").getValue()))).size(), 0);
Assert.assertEquals(((ComplexIssueInputFieldValue) (issueInput.getField("project").getValue())).getValuesMap().get("key"), PROJECT_KEY);
Assert.assertNull(issueInput.getField("reporter"));
Assert.assertNull(issueInput.getField("assignee"));
// check attachments have been added (screenshot + detailed results)
verify(issueRestClient, never()).addAttachments(eq(new URI("http://foo/bar/i/1/attachments")), any(File.class));
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testCreateIssueWithMinimalFieldsOtherEmpty.
/**
* Test issue creation without fields, components, screenshots, ...
* @throws URISyntaxException
*/
@Test(groups = { "ut" })
public void testCreateIssueWithMinimalFieldsOtherEmpty() throws URISyntaxException {
ArgumentCaptor<IssueInput> issueArgument = ArgumentCaptor.forClass(IssueInput.class);
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", "", "Bug", "", null, "", "", new ArrayList<>(), null, new HashMap<>(), new ArrayList<>());
jiraConnector.createIssue(jiraBean);
verify(issueRestClient).createIssue(issueArgument.capture());
// check issue has only mandatory fields
IssueInput issueInput = ((IssueInput) issueArgument.getValue());
Assert.assertEquals(issueInput.getField("summary").getValue(), "issue 1");
Assert.assertEquals(issueInput.getField("description").getValue(), "issue 1 descr");
Assert.assertEquals(((ComplexIssueInputFieldValue) (issueInput.getField("issuetype").getValue())).getValuesMap().get("id"), "1");
Assert.assertEquals(ImmutableList.copyOf(((Iterable<ComplexIssueInputFieldValue>) (issueInput.getField("components").getValue()))).size(), 0);
Assert.assertEquals(((ComplexIssueInputFieldValue) (issueInput.getField("project").getValue())).getValuesMap().get("key"), PROJECT_KEY);
Assert.assertNull(issueInput.getField("reporter"));
Assert.assertNull(issueInput.getField("assignee"));
Assert.assertNull(issueInput.getField("priority"));
// check attachments have been added (screenshot + detailed results)
verify(issueRestClient, never()).addAttachments(eq(new URI("http://foo/bar/i/1/attachments")), any(File.class));
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector 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");
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testCreateIssueUnknownFieldValue.
/**
* Test issue creation with field value. No error should be raised (but issue may not be created if field is mandatory)
* @throws URISyntaxException
*/
@Test(groups = { "ut" })
public void testCreateIssueUnknownFieldValue() {
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
Map<String, String> fields = new HashMap<>();
// field allowed by jira
fields.put("step", "step3");
JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", "P1", "Bug", null, null, null, null, new ArrayList<>(), null, fields, new ArrayList<>());
jiraConnector.createIssue(jiraBean);
}
Aggregations