Hello,
I am trying to set up a JBehave + Spring based on the Etsy samples.
However, here is what I get when I run the stories:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'steps' defined in class path resource
[META-INF/spring/steps.xml]: Instantiation of bean failed; nested exception
is org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class [com.bignibou.bdd.steps.WebSteps]: Constructor threw
exception; nested exception is
org.jbehave.web.selenium.DelegatingWebDriverProvider$DelegateWebDriverNotFound:
WebDriver has not been found for this thread.
Please verify you are using the correct WebDriverProvider, with the
appropriate credentials if using remote access, e.g. to SauceLabs:
-DSAUCE_USERNAME=xxxxxx -DSAUCE_ACCESS_KEY=xxx-xxxx-xxxx-xxxx-xxx
Can anyone please help?
Regards,
Julien.
Here is my Stories source:
@RunWith(SpringAnnotatedEmbedderRunner.class)
@Configure()
@UsingEmbedder(embedder = Embedder.class, generateViewAfterStories = true,
ignoreFailureInStories = true, ignoreFailureInView = true)
@UsingSpring(resources = {
"classpath:META-INF/spring/applicationContext.xml",
"classpath:META-INF/spring/steps.xml" })
@UsingSteps(instances = { WebSteps.class })
public class SpringWebStories extends InjectableEmbedder {
@Test
public void run() {
injectedEmbedder().runStoriesAsPaths(storyPaths());
}
protected List<String> storyPaths() {
String searchInDirectory =
CodeLocations.codeLocationFromPath("src/test/java").getFile();
return new StoryFinder().findPaths(searchInDirectory,
Arrays.asList("**/*.story"), null);
}
}
Here is my WebSteps source:
public class WebSteps {
@Autowired
private JavaMailSender javaMailSender;
private Home home;
public WebSteps(PageFactory factory) {
this.home = factory.home();
}
@Given("the following email address: $email and a chosen member status of
$status and the following password: $password")
public void anonymousVisitorEntersDetails(String email, String status,
String password) {
System.out.println("instance:" + javaMailSender);
home.open();
home.enterDetails(email, status, password);
}
@When("the anonymous visitor signs up")
public void anonymousVisitorDoesRegister(String login, String password) {
home.doRegister();
}
@Then("a confirmation email with activation information is sent to the
anonymous visitor")
public void activationInformationIsSent() {
}
...
Here is my steps.xml:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
">
<bean id="driverProvider"
class="org.jbehave.web.selenium.FirefoxWebDriverProvider">
</bean>
<bean id="webDriverProvider"
class="org.jbehave.web.selenium.PerStoryWebDriverSteps">
<constructor-arg ref="driverProvider" />
</bean>
<bean id="lifecycleSteps" class="com.bignibou.bdd.steps.LifecycleSteps">
<constructor-arg ref="driverProvider" />
</bean>
<bean id="pageFactory" class="com.bignibou.bdd.pages.PageFactory">
<constructor-arg ref="driverProvider" />
</bean>
<bean id="steps" class="com.bignibou.bdd.steps.WebSteps">
<constructor-arg ref="pageFactory" />
</bean>
</beans>