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");
}
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();
}
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);
}
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'");
}
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");
}
Aggregations