Search in sources :

Example 1 with Pickle

use of gherkin.pickles.Pickle 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");
}
Also used : Pickle(gherkin.pickles.Pickle) PickleLocation(gherkin.pickles.PickleLocation) PickleEvent(gherkin.events.PickleEvent) CucumberScenarioWrapper(com.seleniumtests.core.runner.CucumberScenarioWrapper) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest)

Example 2 with Pickle

use of gherkin.pickles.Pickle 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 |");
}
Also used : Pickle(gherkin.pickles.Pickle) PickleLocation(gherkin.pickles.PickleLocation) PickleEvent(gherkin.events.PickleEvent) CucumberScenarioWrapper(com.seleniumtests.core.runner.CucumberScenarioWrapper) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest)

Aggregations

MockitoTest (com.seleniumtests.MockitoTest)2 CucumberScenarioWrapper (com.seleniumtests.core.runner.CucumberScenarioWrapper)2 PickleEvent (gherkin.events.PickleEvent)2 Pickle (gherkin.pickles.Pickle)2 PickleLocation (gherkin.pickles.PickleLocation)2 Test (org.testng.annotations.Test)2