Search in sources :

Example 26 with TestStep

use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.

the class TestTestStep method testTestStepWithrootCauseInSubStep.

/**
 * Check error cause of a sub step is transferred to root step
 */
@Test(groups = { "ut" })
public void testTestStepWithrootCauseInSubStep() {
    TestStep step = new TestStep("step1", null, new ArrayList<>(), true);
    TestStep subStep = new TestStep("step1", null, new ArrayList<>(), true, RootCause.REGRESSION, "details", false);
    // mandatory so that errorCauseDetails is not null
    subStep.setFailed(true);
    step.addStep(subStep);
    Assert.assertEquals(step.getRootCause(), RootCause.REGRESSION);
    Assert.assertEquals(step.getRootCauseDetails(), "details");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 27 with TestStep

use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.

the class TestTestStep method testSnapshotRenaming.

/**
 * Test that when adding a snapshot to a test step, it's renamed with a name
 * containing test name, step name and index
 *
 * @throws IOException
 */
@Test(groups = { "ut" })
public void testSnapshotRenaming() throws IOException {
    TestStep step = new TestStep("step1", null, new ArrayList<>(), true);
    ScreenShot screenshot = new ScreenShot();
    File tmpImgFile = File.createTempFile("img", ".png");
    File tmpHtmlFile = File.createTempFile("html", ".html");
    screenshot.setOutputDirectory(tmpImgFile.getParent());
    screenshot.setLocation("http://mysite.com");
    screenshot.setTitle("mysite");
    screenshot.setImagePath(tmpImgFile.getName());
    screenshot.setHtmlSourcePath(tmpHtmlFile.getName());
    step.addSnapshot(new Snapshot(screenshot, "main", SnapshotCheckType.TRUE), 0, null);
    Assert.assertEquals(step.getSnapshots().get(0).getScreenshot().getImagePath(), "N-A_0-1_step1--" + tmpImgFile.getName().substring(tmpImgFile.getName().length() - 10));
    Assert.assertEquals(step.getSnapshots().get(0).getScreenshot().getHtmlSourcePath(), "N-A_0-1_step1--" + tmpHtmlFile.getName().substring(tmpHtmlFile.getName().length() - 10));
    tmpImgFile.deleteOnExit();
    tmpHtmlFile.deleteOnExit();
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) Snapshot(com.seleniumtests.reporter.logger.Snapshot) ScreenShot(com.seleniumtests.driver.screenshots.ScreenShot) File(java.io.File) GenericFile(com.seleniumtests.reporter.logger.GenericFile) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 28 with TestStep

use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.

the class TestErrorCause method testEqualsDifferentDescription.

@Test(groups = { "ut" })
public void testEqualsDifferentDescription() {
    ErrorCause cause1 = new ErrorCause(ErrorType.APPLICATION_CHANGED, "some changes", new TestStep("step1", null, new ArrayList<>(), true));
    ErrorCause cause2 = new ErrorCause(ErrorType.APPLICATION_CHANGED, "some changes2", new TestStep("step1", null, new ArrayList<>(), true));
    Assert.assertNotEquals(cause1, cause2);
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) ErrorCause(com.seleniumtests.core.testanalysis.ErrorCause) ArrayList(java.util.ArrayList) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 29 with TestStep

use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.

the class TestErrorCause method testToString.

@Test(groups = { "ut" })
public void testToString() {
    String desc = new ErrorCause(ErrorType.APPLICATION_CHANGED, "some changes", new TestStep("step1", null, new ArrayList<>(), true)).toString();
    Assert.assertEquals(desc, "The application has been modified: some changes on step 'step1'");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) ErrorCause(com.seleniumtests.core.testanalysis.ErrorCause) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 30 with TestStep

use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.

the class TestErrorCause method testToStringWithRootCauseNoDetails.

@Test(groups = { "ut" })
public void testToStringWithRootCauseNoDetails() {
    TestStep step = new TestStep("step1", null, new ArrayList<>(), true, RootCause.DEPENDENCIES, "", false);
    step.setFailed(true);
    String desc = new ErrorCause(ErrorType.ERROR_MESSAGE, "some changes", step).toString();
    Assert.assertEquals(desc, "Error message displayed: some changes on step 'step1'\n" + "Declared root Cause: DEPENDENCIES");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) ErrorCause(com.seleniumtests.core.testanalysis.ErrorCause) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Aggregations

TestStep (com.seleniumtests.reporter.logger.TestStep)190 Test (org.testng.annotations.Test)148 GenericTest (com.seleniumtests.GenericTest)120 ArrayList (java.util.ArrayList)80 TestAction (com.seleniumtests.reporter.logger.TestAction)47 File (java.io.File)37 ScreenShot (com.seleniumtests.driver.screenshots.ScreenShot)25 Snapshot (com.seleniumtests.reporter.logger.Snapshot)24 ErrorCause (com.seleniumtests.core.testanalysis.ErrorCause)19 TestMessage (com.seleniumtests.reporter.logger.TestMessage)16 GenericFile (com.seleniumtests.reporter.logger.GenericFile)15 MockitoTest (com.seleniumtests.MockitoTest)12 HashMap (java.util.HashMap)12 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)12 ITestResult (org.testng.ITestResult)10 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)9 Uft (com.seleniumtests.connectors.extools.Uft)8 DriverExceptions (com.seleniumtests.customexception.DriverExceptions)8 ConfigurationException (com.seleniumtests.customexception.ConfigurationException)7 SeleniumRobotServerException (com.seleniumtests.customexception.SeleniumRobotServerException)6