Search in sources :

Example 6 with BugTracker

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

the class TestBugTracker method testUpdateIssue.

/**
 * Update an existing issue as we fail on an other step
 * @throws Exception
 */
@Test(groups = { "ut" })
public void testUpdateIssue() throws Exception {
    FakeBugTracker fbt = spy(new FakeBugTracker());
    PowerMockito.whenNew(FakeBugTracker.class).withAnyArguments().thenReturn(fbt);
    when(fbt.issueAlreadyExists(any(IssueBean.class))).thenReturn(new IssueBean("ISSUE-1", "[Selenium][app][env][ng] test Test1 KO", "Test KO"));
    BugTracker bugtracker = BugTracker.getInstance("fake", "http://foo/bar", "selenium", "user", "password", new HashMap<>());
    bugtracker.createIssue("selenium", "DEV", "ngName", "testUpdateIssue", "some description", Arrays.asList(step1, step2, stepEnd), issueOptions);
    // check that we check if the issue already exists
    verify(fbt).issueAlreadyExists(any(IssueBean.class));
    // check that issue is not created
    verify(fbt, never()).createIssue(any(IssueBean.class));
    verify(fbt).updateIssue(eq("ISSUE-1"), anyString(), anyList(), eq(step2));
}
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 7 with BugTracker

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

the class TestBugTracker method testOneInstanceIsCreatedForEachUrl.

@Test(groups = { "ut" })
public void testOneInstanceIsCreatedForEachUrl() throws Exception {
    BugTracker bugtracker1 = BugTracker.getInstance("fake", "http://foo/bar2", "selenium", "user", "password", new HashMap<>());
    BugTracker bugtracker2 = BugTracker.getInstance("fake", "http://foo/bar", "selenium", "user", "password", new HashMap<>());
    Assert.assertNotEquals(bugtracker1, bugtracker2);
}
Also used : 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 8 with BugTracker

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

the class TestBugTracker method testCreateIssueBeanNoStep.

/**
 * If no steps are available, do not create IssueBean
 * @throws Exception
 */
@Test(groups = { "ut" })
public void testCreateIssueBeanNoStep() 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", new ArrayList<>(), 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 9 with BugTracker

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

the class TestBugTracker method testDoNotCreateIssue.

/**
 * Test issue is not created if no failed step is present during execution
 * @throws Exception
 */
@Test(groups = { "ut" })
public void testDoNotCreateIssue() 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<>());
    bugtracker.createIssue("selenium", "DEV", "ngName", "testDoNotCreateIssue", "some description", Arrays.asList(step1, stepEnd), issueOptions);
    // check that we check if the issue already exists
    verify(fbt, never()).issueAlreadyExists(any(IssueBean.class));
    // check that issue is created
    verify(fbt, never()).createIssue(any(IssueBean.class));
}
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 10 with BugTracker

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

the class TestBugTracker method testDoNotUpdateIssue.

/**
 * Do not update existing issue as we fail on the same step
 * @throws Exception
 */
@Test(groups = { "ut" })
public void testDoNotUpdateIssue() throws Exception {
    FakeBugTracker fbt = spy(new FakeBugTracker());
    PowerMockito.whenNew(FakeBugTracker.class).withAnyArguments().thenReturn(fbt);
    when(fbt.issueAlreadyExists(any(IssueBean.class))).thenReturn(new IssueBean("ISSUE-1", "[Selenium][app][env][ng] test Test1 KO", String.format(BugTracker.STEP_KO_PATTERN, 1)));
    BugTracker bugtracker = BugTracker.getInstance("fake", "http://foo/bar", "selenium", "user", "password", new HashMap<>());
    bugtracker.createIssue("selenium", "DEV", "ngName", "testDoNotUpdateIssue", "some description", Arrays.asList(step1, step2, stepEnd), issueOptions);
    // check that we check if the issue already exists
    verify(fbt).issueAlreadyExists(any(IssueBean.class));
    // check that issue is not created
    verify(fbt, never()).createIssue(any(IssueBean.class));
    verify(fbt, never()).updateIssue(eq("ISSUE-1"), anyString(), anyList(), eq(step2));
}
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)

Aggregations

BugTracker (com.seleniumtests.connectors.bugtracker.BugTracker)13 MockitoTest (com.seleniumtests.MockitoTest)12 FakeBugTracker (com.seleniumtests.connectors.bugtracker.FakeBugTracker)12 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)12 Test (org.testng.annotations.Test)12 IssueBean (com.seleniumtests.connectors.bugtracker.IssueBean)10 JiraConnector (com.seleniumtests.connectors.bugtracker.jira.JiraConnector)1 SeleniumTestsContext (com.seleniumtests.core.SeleniumTestsContext)1 TestVariable (com.seleniumtests.core.TestVariable)1 HyperlinkInfo (com.seleniumtests.reporter.info.HyperlinkInfo)1 StringInfo (com.seleniumtests.reporter.info.StringInfo)1 TestStep (com.seleniumtests.reporter.logger.TestStep)1 SeleniumTestsReporter2 (com.seleniumtests.reporter.reporters.SeleniumTestsReporter2)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Set (java.util.Set)1 ITestContext (org.testng.ITestContext)1 ITestResult (org.testng.ITestResult)1