use of com.seleniumtests.core.runner.CucumberScenarioWrapper in project seleniumRobot by bhecquet.
the class TestCucumberScenarioWrapper method testScenarioToStringShortPlaceholder.
/**
* With placeholder on scenario outline, we use the pickle name as placeholders have been replaced
* @param testNGCtx
*/
@Test(groups = { "ut" })
public void testScenarioToStringShortPlaceholder(ITestContext testNGCtx) {
when(cucumberScenarioWithExample.getName()).thenReturn("short <foo>");
Pickle pickle2 = new Pickle("short foobar", "en", new ArrayList<>(), new ArrayList<>(), // location for scenario outline
Arrays.asList(// location for scenario outline
new PickleLocation(2, 2), new PickleLocation(6, 5)));
PickleEvent pickleEvent2 = new PickleEvent("uri", pickle2);
Assert.assertEquals(new CucumberScenarioWrapper(pickleEvent2, cucumberScenarioWithExample).toString(150), "short foobar");
}
use of com.seleniumtests.core.runner.CucumberScenarioWrapper in project seleniumRobot by bhecquet.
the class TestSeleniumTestContext3 method testNewOutputFolderWithOddTestName.
/**
* Check that with a test name containing special characters, we create an
* output folder for this test whose name is the name of the test
*
* @throws IllegalAccessException
* @throws IllegalArgumentException
* @throws NoSuchFieldException
* @throws SecurityException
* @throws NoSuchMethodException
*/
@Test(groups = "ut")
public void testNewOutputFolderWithOddTestName(final ITestContext testNGCtx) throws NoSuchMethodException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
initThreadContext(testNGCtx);
ITestResult testResult = GenericTest.generateResult(testNGCtx, getClass());
CucumberScenarioWrapper scenarioWrapper = mock(CucumberScenarioWrapper.class);
when(scenarioWrapper.toString()).thenReturn("<test | with @ chars>");
CucumberScenarioWrapper[] params = new CucumberScenarioWrapper[] { scenarioWrapper };
testResult.setParameters(params);
SeleniumTestsContextManager.updateThreadContext(testResult);
String key = testNGCtx.getSuite().getName() + "-" + testNGCtx.getName() + "-" + "com.seleniumtests.ut.core.TestSeleniumTestContext3" + "-" + "-test__with_@_chars-" + "-" + Arrays.hashCode(params);
Assert.assertTrue(SeleniumTestsContext.getOutputFolderNames().containsKey(key));
Assert.assertEquals(SeleniumTestsContextManager.getThreadContext().getRelativeOutputDir(), "-test__with_@_chars-");
}
use of com.seleniumtests.core.runner.CucumberScenarioWrapper in project seleniumRobot by bhecquet.
the class TestCucumberScenarioWrapper method testScenarioEqualLong.
/**
* Check the unstripped version is used to compare 2 cucumberscenariowrappers
* @param testNGCtx
*/
@Test(groups = { "ut" })
public void testScenarioEqualLong(ITestContext testNGCtx) {
when(cucumberScenario.getName()).thenReturn("a very long scenario outline name with some special characters like @ and |. But we should not strip it, only display a message saying its much too long.");
when(cucumberScenario2.getName()).thenReturn("a very long scenario outline name with some special characters like @ and |. But we should not strip it, only display a message saying its much too long.2");
Assert.assertNotEquals(new CucumberScenarioWrapper(pickleEventLong, cucumberScenario), new CucumberScenarioWrapper(pickleEventLong2, cucumberScenario2));
}
use of com.seleniumtests.core.runner.CucumberScenarioWrapper in project seleniumRobot by bhecquet.
the class TestCucumberScenarioWrapper method testScenarioToStringShortNoPlaceholder.
/**
* Without placeholder on scenario outline, we use the scenario outline description plus example value
* @param testNGCtx
*/
@Test(groups = { "ut" })
public void testScenarioToStringShortNoPlaceholder(ITestContext testNGCtx) {
when(cucumberScenarioWithExample.getName()).thenReturn("short");
Pickle pickle2 = new Pickle("short", "en", new ArrayList<>(), new ArrayList<>(), // location for scenario outline
Arrays.asList(// location for scenario outline
new PickleLocation(2, 2), // location for example
new PickleLocation(6, 5)));
PickleEvent pickleEvent2 = new PickleEvent("uri", pickle2);
Assert.assertEquals(new CucumberScenarioWrapper(pickleEvent2, cucumberScenarioWithExample).toString(-1), "short-| bar | bar2 |");
}
Aggregations