I've not been able to investigate your problem as I would need to first reproduce it. This is why I was asking for a fork on github where we could reproduce and investigate it.

WRT your questions:

1. the issue is most likely in the extra @BeforeScenario/Story steps that you've defined. The WebDriver is set in the PerScenario/StoryWebDriverSteps annotated methods
2.  it's got nothing to do with the location of the java/story files.


On 12/02/2013 16:41, Julien Martin wrote:
Hi Mauro!

My codebase is actually slightly different from the one described in the JIRA. I do get the same error message though...

I've spent the best of the day trying to figure out the difference between my codebase and that of the maven archetype (spring+web) which does work fine. To no avail.

I have two questions:
1. By looking at the code provided in my prior email, can you spot something wrong? 2. Can you tell me whether all my JBehave code (java files, story files) should be located in src/main/ or src/test?

Regards,

Julien.

2013/2/12 Mauro Talevi <[email protected] <mailto:[email protected]>>

    I've commented on it.

    Same advice to you:

    Would it be possible for you to clone the jbehave-tutorial in
    github and provide your modifications in different branches?

    In this way, it's much easier to see what changing wrt to a
    working scenario to work with an easily reproducible codebase.

    Cheers


    On 12/02/2013 14:28, Julien Martin wrote:
    Hi,
    I noticed someone has encountered the same problem. See here:
    http://jira.codehaus.org/browse/JBEHAVE-790
    Any update on this issue?
    Julien.

    2013/2/11 Julien Martin <[email protected] <mailto:[email protected]>>

        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>





Reply via email to