Awesome, works like a charm. Thanks for all you guy's work!
On 1/10/12 4:01 PM, "Mauro Talevi" <[email protected]> wrote:
>public class GivenRelativePathStory extends TraderStory {
>
> @Override
> public Configuration configuration() {
> return super.configuration().usePathCalculator(new
>RelativePathCalculator());
> }
>
>}
>
>On 11/01/2012 00:52, Carlos Silva wrote:
>> Thanks Mauro, that worked.
>>
>> I'm now just having trouble running the GivenStories with a relative
>>path.
>>
>> This works:
>> GivenStories:
>> com/symantec/automation/testdrive/stories/register_for_test_drive.task
>>
>> This does not work:
>> GivenStories: register_for_test_drive.task
>>
>> gives the following error:
>>
>> Failed to run story
>> com/symantec/automation/testdrive/stories/test_drive_registration.story
>> [testng] org.jbehave.core.io.StoryResourceNotFound: Story path
>> 'register_for_test_drive.task' not found by class loader
>> sun.misc.Launcher$AppClassLoader@40affc70
>> [testng] at
>>
>>org.jbehave.core.io.LoadFromClasspath.resourceAsStream(LoadFromClasspath.
>>ja
>> va:45)
>>
>>
>> I'll keep looking to see what the problem might be but do let me know if
>> I'm missing something silly like before.
>>
>> Carlos
>>
>> On 1/10/12 1:11 PM, "Mauro Talevi"<[email protected]> wrote:
>>
>>> GivenStories is a precondition to scenario steps. You should have at
>>> least one step after the GivenStories.
>>>
>>> Also, I'm not sure if Meta can go after GivenStories. I would have
>>>Meta
>>> following the Scenario keyword.
>>>
>>> On 10/01/2012 21:54, Carlos Silva wrote:
>>>> I'm trying to use the GivenStories feature of jbehave-core-3.5.1 but
>>>>the
>>>> story using it always shows as pending. My story runs fine when not
>>>> using
>>>> GivenStories and including the steps directly in the story. Any help
>>>> would
>>>> be greatly appreciated.
>>>>
>>>> My story:
>>>>
>>>> In order to try out the magnum product,
>>>> As a potential customer,
>>>> I want to be able to register for a test drive account.
>>>>
>>>> Scenario: successfully registers for test drive
>>>>
>>>> GivenStory: register_for_test_drive.task
>>>>
>>>> Meta:
>>>> @type positive
>>>> @component test-drive
>>>> @suite acceptance
>>>> @level 1
>>>>
>>>>
>>>> My story has no steps as I just want to call the GivenStory steps, in
>>>> the
>>>> same directory I have register_for_test_drive.task with a simple step
>>>>as
>>>> follows:
>>>>
>>>> Given the user opens the testdrive-registration web page
>>>>
>>>>
>>>> Here is how my stories are configured: TestDriveStories.java
>>>>
>>>> package com.symantec.automation.testdrive.stories;
>>>>
>>>> public class TestDriveStories extends JUnitStories {
>>>>
>>>> private WebDriverProvider driverProvider = new
>>>> PropertyWebDriverProvider();
>>>> private WebDriverSteps lifecycleSteps = new
>>>> PerStoryWebDriverSteps(driverProvider);
>>>> private Pages pages = new Pages(driverProvider);
>>>> private SeleniumContext context = new SeleniumContext();
>>>> private ContextView contextView = new
>>>> LocalFrameContextView().sized(500,
>>>> 100);
>>>>
>>>> public TestDriveStories() {
>>>>
>>>>
>>>>
>>>>configuredEmbedder().useExecutorService(MoreExecutors.sameThreadExecuto
>>>>r(
>>>> ))
>>>> ;
>>>> configuredEmbedder().useMetaFilters(asList("-ignore"));
>>>> configuredEmbedder().embedderControls()
>>>> .doIgnoreFailureInStories(true)
>>>> .doIgnoreFailureInView(false)
>>>> .doGenerateViewAfterStories(true);
>>>> }
>>>>
>>>> public Configuration configuration() {
>>>> Class<? extends Embeddable> embeddableClass = this.getClass();
>>>> return new SeleniumConfiguration()
>>>> .useSeleniumContext(context)
>>>> .useWebDriverProvider(driverProvider)
>>>> .useStepMonitor(new SeleniumStepMonitor(contextView,
>>>>context,
>>>> new
>>>> SilentStepMonitor()))
>>>> .useStoryLoader(new LoadFromClasspath(embeddableClass))
>>>> .useStoryReporterBuilder(new StoryReporterBuilder()
>>>>
>>>>.withRelativeDirectory("reports/tests/functional/jbehave")
>>>>
>>>>.withCodeLocation(codeLocationFromClass(embeddableClass))
>>>> .withDefaultFormats()
>>>> .withFormats(CONSOLE, WebDriverHtmlOutput.WEB_DRIVER_HTML));
>>>> }
>>>>
>>>> public InjectableStepsFactory stepsFactory() {
>>>> Configuration configuration = configuration();
>>>> return new InstanceStepsFactory(configuration,
>>>> new TestDriveSteps(pages),
>>>> lifecycleSteps,
>>>> new WebDriverScreenshotOnFailure(driverProvider,
>>>> configuration.storyReporterBuilder()));
>>>> }
>>>>
>>>> protected List<String> storyPaths() {
>>>> return new StoryFinder()
>>>> .findPaths(codeLocationFromClass(this.getClass()).getFile(),
>>>> asList("**/*.story"), null);
>>>> }
>>>>
>>>> // This Embedder is used by Maven or Ant and it will override
>>>> anything
>>>> set in the constructor
>>>> public static class SameThreadEmbedder extends Embedder {
>>>> public SameThreadEmbedder() {
>>>> useExecutorService(MoreExecutors.sameThreadExecutor());
>>>> }
>>>> }
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email