Graham, for me, using Embedder is the best for such needs... the example that was given for Zoltan is a little bit confuse, actually...

Look at the example below. I'm specifying the Step classes that I want and the local where the stories should be searched (in my case its using the classpath).

Note that the Embedder always needs ONE Configuration object wherever it comes from. If none is informed it will use a default one:

@RunWith(AnnotatedEmbedderRunner.class)
*@Configure(using = MyConfiguration.class, stepPatternParser = MyRegexPrefixCapturingPatternParser.class, storyControls = MyStoryControls.class, storyLoader = MyStoryLoader.class, storyReporterBuilder = MyReportBuilder.class, parameterConverters = { MyDateConverter.class })* @UsingEmbedder(systemProperties = "JBEHAVE_WEBDRIVER_FIREFOX_PROFILE=jbehave", embedder = MyEmbedder.class, generateViewAfterStories = true, ignoreFailureInStories = false, ignoreFailureInView = false, verboseFailures = true, storyTimeoutInSecs = 100, threads = 1, metaFilters = "-skip")
*@UsingSteps(instances = { MyLifeCycleSteps.class,
        MyInjectedAuthenticationSteps.class })*
public class TaskManagerApplicationAnnotatedEmbedder extends InjectableEmbedder {

private static final WebDriverProvider staticDriverProvider = new FirefoxWebDriverProvider(); private static WebDriverSteps lifecycleSteps = new PerStoriesWebDriverSteps(
            staticDriverProvider);
private static final TaskWebPageFactory pages = new TaskWebPageFactory(
            staticDriverProvider);
    private static SeleniumContext context = new SeleniumContext();
private static ContextView contextView = new LocalFrameContextView().sized(
            500, 100);

    @Test
*public void run() {
        List<String> storyPaths = new StoryFinder().findPaths(
                codeLocationFromClass(this.getClass()).getFile(),
                asList("**/*.story"), null);
        injectedEmbedder().runStoriesAsPaths(storyPaths);
    }*

    public static class MyConfiguration extends SeleniumConfiguration {
        public MyConfiguration() {
            useFailureStrategy(new RethrowingFailure());
            usePendingStepStrategy(new FailingUponPendingStep());
            useSeleniumContext(context);
            useWebDriverProvider(staticDriverProvider);
            useStepMonitor(new SeleniumStepMonitor(contextView, context,
                    new SilentStepMonitor()));
        }
    }


On 08/03/12 14:24, Graham Abell wrote:
Hi Mauro,

in the example Zoltan gave, what's the point of providing the story paths to the embedder if you then have to specify a location in the config? Is there a way around that or which one takes precedence?

cheers,
graham

On 8 March 2012 16:55, Mauro Talevi <[email protected] <mailto:[email protected]>> wrote:

    Hi,

    you can use the StoryFinder with the
    CodeLocations.codeLocationFromPath("/your/absolute/path") as your
    searchIn URL.

    Cheers


    On 08/03/2012 17:20, Penzeli, Zoltan wrote:

        Hi All,


        We are in the middle of creating our BDD framework, and
        haven't yet
        decided where our .story files will be - but most likely they
        will be in
        a directory well separated from our Java project.

        We tried the following code:

        ****************************

        public Configuration configuration() {

                URL url = null;
                try {
                    url = new URL("file://" +
        System.getProperty("user.dir") +
        "/JBehave/src");
                } catch (MalformedURLException e) {
                    return null;
                }

                Class<?>  embedderClass = this.getClass();
                URL codeLocation =
        CodeLocations.codeLocationFromClass(embedderClass);
                Configuration configuration = new
        MostUsefulConfiguration()
                        .useStoryLoader(new LoadFromRelativeFile(url))
                        .useStoryReporterBuilder(new
        StoryReporterBuilder()
                                .withCodeLocation(codeLocation)
                                .withDefaultFormats());
                return configuration;
            }

        ****************************

        public void SmoketestSteps() {

                Embedder embedder = new StackEmbedder();
                StoryFinder finder = new StoryFinder();
                String storyLocation = System.getProperty("user.dir") +
        "/JBehave/src/";
                List<String>  storyPaths = finder.findPaths(storyLocation,
                        Arrays.asList("**/*.story"),
                        Arrays.asList("**/*smoke*"),
                        "");

                embedder.runStoriesAsPaths(storyPaths);
          }

        (Actually it did us a bit of a time to realise what kind of
        StoryLoader
        we should use...)

        It seems to be running but nothing is actually executed.
        Moreover, we
        couldn't really understand what's the function of the
        constructor of
        LoadFromRelativeFile() AND the first parameter of
        finder.findPaths().
        The latter doesn't seem to have any effect on the execution.

        We couldn't find any concrete example how Stories could be
        found and run
        from _absolute_ paths - if this is possible at all with the
        current
        code.

        It would nice if someone could provide one...

        Best Regards,

        Zoltan

        ________________________________________________________________________
        Privileged, confidential and/or copyright information may be
        contained in this communication. This e-mail and any files
        transmitted with it are confidential and intended solely for
        the use of the individual or entity to whom they are
        addressed. If you are not the intended addressee, you may not
        copy, forward, disclose or otherwise use this e-mail or any
        part of it in any way whatsoever. To do so is prohibited and
        may be unlawful. If you have received this email in error
        please notify the sender immediately.

        Paddy Power PLC may monitor the content of e-mail sent and
        received for the purpose of ensuring compliance with its
        policies and procedures.

        Paddy Power plc, Power Tower, Blocks 1-3 Belfield Office Park,
        Beech Hill Road, Clonskeagh, Dublin 4.  Registered in Ireland:
        16956
        ________________________________________________________________________

        ---------------------------------------------------------------------
        To unsubscribe from this list, please visit:

        http://xircles.codehaus.org/manage_email




    ---------------------------------------------------------------------
    To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Reply via email to