--
You received this message because you are subscribed to the Google Groups "Serenity BDD Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-use...@googlegroups.com.
To post to this group, send email to thucydid...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
public class StoriesRunner extends SerenityStories{
public StoriesRunner() {
runSerenity().inASingleSession();
}
@Override
public List<String> storyPaths() {
return new StoryFinder().findPaths(codeLocationFromClass(this.getClass()).getFile(), asList("**/example1.story", "**/example2.story"), null);
}
public static WebDriver getWebDriver() {
return ThucydidesWebDriverSupport.getDriver();
}
}
public class MainSteps extends ScenarioSteps{
@Step
public void stepExample(){
StoriesRunner.getWebDriver().get("http://www.google.com");
}
@When("example step")
public void behaveExample(){
stepExample();
}
}Meta:
Scenario: example1
When example stepMeta:
Scenario: example2
When example step
<build>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
<filtering>false</filtering>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>${basedir}/src/test/java</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>${basedir}/src/test/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>3.8</version>
<executions>
<execution>
<id>run-stories</id>
<phase>integration-test</phase>
<configuration>
<includes>
<include>**/StoriesRunner.java</include>
</includes>
<executorsClass>org.jbehave.core.embedder.executors.SameThreadExecutors</executorsClass>
<systemProperties>
<property>
<name>file.encoding</name>
<value>${project.build.sourceEncoding}</value>
</property>
</systemProperties>
<metaFilters>
<metaFilter>-skip</metaFilter>
</metaFilters>
<ignoreFailureInStories>true</ignoreFailureInStories>
<ignoreFailureInView>true</ignoreFailureInView>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>17.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>public void afterStory(boolean given) {
logger.debug("afterStory " + given);
shouldNestScenarios(false);
if (given) {
givenStoryMonitor.exitingGivenStory();
givenStoryDone(currentStory());
} else {
closeBrowsersForThisStory();
if (isAfterStory(currentStory())) {
generateReports();
} else if (!isFixture(currentStory()) && (!isAStoryLevelGiven(currentStory()))) {
StepEventBus.getEventBus().testSuiteFinished();
clearListeners();
}
}
storyStack.pop();
}
private void closeBrowsersForThisStory() { if (drivers.containsKey(currentStory())) { drivers.get(currentStory()).close(); drivers.get(currentStory()).quit(); drivers.remove(currentStory()); } }public void afterStory(boolean given) {
shouldNestScenarios(false);
if (given) {
givenStoryMonitor.exitingGivenStory();
givenStoryDone(currentStory());
} else {
if (isAfterStory(currentStory())) {
closeBrowsersForThisStory();
generateReports();
} else if (!isFixture(currentStory()) && !given && (!isAStoryLevelGiven(currentStory()))) {
StepEventBus.getEventBus().testSuiteFinished();
clearListeners();
}
}
storyStack.pop();
}
private void closeBrowsersForThisStory() { if (!systemConfiguration.getUseUniqueBrowser()) { ThucydidesWebDriverSupport.closeAllDrivers(); } }