Search in sources :

Example 6 with FakeBugTracker

use of com.seleniumtests.connectors.bugtracker.FakeBugTracker 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 7 with FakeBugTracker

use of com.seleniumtests.connectors.bugtracker.FakeBugTracker 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)

Example 8 with FakeBugTracker

use of com.seleniumtests.connectors.bugtracker.FakeBugTracker 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 9 with FakeBugTracker

use of com.seleniumtests.connectors.bugtracker.FakeBugTracker 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)

Aggregations

MockitoTest (com.seleniumtests.MockitoTest)9 BugTracker (com.seleniumtests.connectors.bugtracker.BugTracker)9 FakeBugTracker (com.seleniumtests.connectors.bugtracker.FakeBugTracker)9 IssueBean (com.seleniumtests.connectors.bugtracker.IssueBean)9 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)9 Test (org.testng.annotations.Test)9 SeleniumTestsReporter2 (com.seleniumtests.reporter.reporters.SeleniumTestsReporter2)1