Search in sources :

Example 1 with JiraBean

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

the class BugTracker method closeIssue.

/**
 * Close issue if it exists
 * @param application
 * @param environment
 * @param testNgName
 * @param testName
 */
public void closeIssue(String application, String environment, String testNgName, String testName) {
    String summary = createIssueSummary(application, environment, testNgName, testName);
    IssueBean issueBean;
    if (this instanceof JiraConnector) {
        issueBean = new JiraBean("", summary, "", "", "");
    } else {
        issueBean = new IssueBean(summary, "", "", null, null, null, null, null);
    }
    // Close issue if it exists
    IssueBean currentIssue = issueAlreadyExists(issueBean);
    if (currentIssue != null) {
        closeIssue(currentIssue.getId(), "Test is now OK");
    }
}
Also used : JiraBean(com.seleniumtests.connectors.bugtracker.jira.JiraBean) JiraConnector(com.seleniumtests.connectors.bugtracker.jira.JiraConnector)

Example 2 with JiraBean

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

the class TestJiraBean method testBeanCreationNoRpiority.

@Test(groups = "ut", expectedExceptions = ConfigurationException.class)
public void testBeanCreationNoRpiority() {
    Map<String, String> customFieldsValues = new HashMap<>();
    new JiraBean("summary", "description", null, "Bug", "testName", null, "assignee", "reporter", new ArrayList<>(), new File(""), customFieldsValues, Arrays.asList("comp1", "comp2"));
}
Also used : HashMap(java.util.HashMap) JiraBean(com.seleniumtests.connectors.bugtracker.jira.JiraBean) File(java.io.File) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 3 with JiraBean

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

the class TestJiraConnector method testCreateIssueNoIssueType.

/**
 * Test issue creation without issue type
 * @throws URISyntaxException
 */
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testCreateIssueNoIssueType() {
    JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
    JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", null, null, null, null, "", null, new ArrayList<>(), null, new HashMap<>(), new ArrayList<>());
    jiraConnector.createIssue(jiraBean);
}
Also used : 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)

Example 4 with JiraBean

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

the class TestJiraConnector method testCreateIssueUnknownField.

/**
 * Test issue creation with wrong field. No error should be raised (but issue may not be created if field is mandatory)
 * @throws URISyntaxException
 */
@Test(groups = { "ut" })
public void testCreateIssueUnknownField() {
    JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
    Map<String, String> fields = new HashMap<>();
    // field not allowed by jira
    fields.put("myfield", "myApp");
    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);
}
Also used : HashMap(java.util.HashMap) JiraBean(com.seleniumtests.connectors.bugtracker.jira.JiraBean) JiraConnector(com.seleniumtests.connectors.bugtracker.jira.JiraConnector) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 5 with JiraBean

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

the class TestJiraConnector method testCreateIssueMissingScreenshotFile.

/**
 * Test the case where the attachment file (file of snapshot is not present)
 * @throws URISyntaxException
 */
@Test(groups = { "ut" })
public void testCreateIssueMissingScreenshotFile() throws URISyntaxException {
    JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
    // simulate screenshot file not present
    new File(screenshot.getFullImagePath()).delete();
    JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", "P1", "Bug", null, null, null, null, Arrays.asList(screenshot), null, new HashMap<>(), new ArrayList<>());
    jiraConnector.createIssue(jiraBean);
    // check attachments (screenshots) have not been added  because screenshot file was not available
    verify(issueRestClient, never()).addAttachments(eq(new URI("http://foo/bar/i/1/attachments")), any(File.class));
}
Also used : JiraBean(com.seleniumtests.connectors.bugtracker.jira.JiraBean) JiraConnector(com.seleniumtests.connectors.bugtracker.jira.JiraConnector) File(java.io.File) URI(java.net.URI) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

JiraBean (com.seleniumtests.connectors.bugtracker.jira.JiraBean)24 Test (org.testng.annotations.Test)23 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)20 JiraConnector (com.seleniumtests.connectors.bugtracker.jira.JiraConnector)19 MockitoTest (com.seleniumtests.MockitoTest)18 File (java.io.File)8 IssueBean (com.seleniumtests.connectors.bugtracker.IssueBean)6 HashMap (java.util.HashMap)6 URI (java.net.URI)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 OptionalIterable (com.atlassian.jira.rest.client.api.OptionalIterable)4 IssueInput (com.atlassian.jira.rest.client.api.domain.input.IssueInput)4 ComplexIssueInputFieldValue (com.atlassian.jira.rest.client.api.domain.input.ComplexIssueInputFieldValue)3 GenericTest (com.seleniumtests.GenericTest)3 ZonedDateTime (java.time.ZonedDateTime)3 SearchResult (com.atlassian.jira.rest.client.api.domain.SearchResult)2 DateTime (org.joda.time.DateTime)1