Hey Guys.
Thanks for helping. I was missing the .withFormats(new
SeleniumContextOutput(seleniumContext), HTML, etc, etc).
Here is the new code, in case it helps anyone else.
public abstract class AbstractSpringConfiguredTestSuite extends
InjectableEmbedder {
private static SeleniumContext seleniumContext = new SeleniumContext();
private ContextView contextView = new
LocalFrameContextView().sized(640,120);
//private Format[] formats = new Format[] { new
SeleniumContextOutput(seleniumContext), CONSOLE, HTML, STATS };
public static SeleniumContext getContext() {
return seleniumContext;
}
@Test
public void run() throws Throwable {
StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder()
.withDefaultFormats().withFormats(new
SeleniumContextOutput(seleniumContext), HTML,STATS,CONSOLE)
.withRelativeDirectory("jbehave-reports")
.withCodeLocation(CodeLocations.codeLocationFromPath("build/test"))
.withFailureTrace(true)
.withFailureTraceCompression(true);
SeleniumConfiguration seleniumConfiguration = (SeleniumConfiguration)
new SeleniumConfiguration()
.useSeleniumContext(seleniumContext)
.useStepMonitor(new SeleniumStepMonitor(contextView,
seleniumContext, new PrintStreamStepMonitor()))
.useStoryReporterBuilder(storyReporterBuilder);
injectedEmbedder().useConfiguration(seleniumConfiguration);
injectedEmbedder().runStoriesAsPaths(storyPaths());
}
protected abstract List<String> storyPaths();
}
I was stepping through the code, and it was obviously not setting the senario
name, but I couldn't figure out what code I needed to set that name or if I
needed to set it myself. I finally completely copied your example code, and
happily it set the scenario name. I then removed CrossReference, than
StepMonitor etc, finding out what code it was that actually set the scenario.
If you can find time when creating your classes to add a one or two liner to
the Javadocs comments, to let us know what the classes are for, I think it will
help. There are many examples, but I find in order to use them, I either have
to completely copy them, or do tons of research finding out what parts I need.
:) I still couldn't tell you what I need all this code for, but at least I
have access to the current scenario now!
Thankfully, you are all very responsive to our questions. I really appreciate
it, especially when I see it's at 3am.
My next move is now to inject the screenshots into the jbehave-reports...
"Mauro Talevi" <[email protected]> wrote in message
news:[email protected]...
The solution requires JBEHAVE-523. I'll be pushing it soon.
On 31 May 2011, at 15:24, Paul Hammant <[email protected]> wrote:
Vicki,
Have you tried adding breakpoints to to debug your way through your
difficulty?
I mean in the underlying JBehave get/sets? I helped me though something
simular. For my case similar to the Etsy case, I overrode JUnit's run() method
and inspected the embedder at that point. I found that the Maven
infrastructure had overwritten some of the things I was trying to
programmatically set. There was nothing wrong with that, it was as per J B
design (for Maven integration) but I did not realize that.
Regards,
- Paul
On Mon, May 30, 2011 at 2:24 AM, Mauro Talevi <[email protected]>
wrote:
Hi Vicki,
you can look at the JBehave Tutorial, there is now a new module that
uses pure Java and Spring for composition:
https://github.com/jbehave/jbehave-tutorial/tree/master/etsy-stories-java-spring
It does not use annotations for configuration though. I'll add another
entry point that does so, but for the moment you can use that example
for your programmatic configuration.
Cheers
On 30/05/2011 07:08, VSS wrote:
> I'm sorry to keep at this, but I still can't get the SelniumContext
> populated. 3 days trying now. Maybe I'm thinking this does what it
doesn't
> do.
> Does JBehave/Selenium actually populate the seleniumContext with the
> scenario or story name, or do I have to? And if so, how do I get the
> scenario name, because if I can do that, I don't need the
seleniumContext.
>
> Is there any documentation on this, or just the examples in
> webtraderexamples?
>
> thanks for your patience.
>
> vicki
>
>
>
>
> "Mauro Talevi" <[email protected]> wrote
> in message news:[email protected]...
>> Hi Vicki,
>>
>> you can override the default configuration in the injectedEmbedder()
via
>> the useConfiguration(SeleniumConfiguration) method.
>>
>> Cheers
>>
>> On 26/05/2011 16:11, VSS wrote:
>>> Hi Mauro.
>>> A portion of our framework code is below. I tried to create a
>>> SeleniumConfiguration and then call
>>> injectedEmbedder.useConfiguration(seleniumConfig). However, when
>>> injectedEmbedder().runStoriesAsPaths(storyPaths()) is called, instead
of
>>> using seleniumConfig, it still uses the MostUsefulConfiguration. The
>>> title
>>> in the SeleniumContext is never set even on failure.
>>>
>>> Thanks.
>>> Vicki
>>>
>>> @RunWith(SpringAnnotatedEmbedderRunner.class)
>>> @Configure(pendingStepStrategy = FailingUponPendingStep.class)
>>> @UsingEmbedder(embedder = Embedder.class, generateViewAfterStories =
>>> true,
>>> ignoreFailureInStories = true, ignoreFailureInView = false,
>>> storyTimeoutInSecs = 100, threads = 1, metaFilters =
>>> "-skip")
>>> @UsingSpring(resources = {"datasources.xml", "properties.xml",
>>> "jbehave-spring-configuration.xml"})
>>>
>>> public abstract class AbstractSpringConfiguredTestSuite extends
>>> InjectableEmbedder {
>>> @Test
>>> public void run() throws Throwable {
>>> injectedEmbedder().configuration()
>>> .useStoryReporterBuilder(new StoryReporterBuilder()
>>> .withRelativeDirectory("jbehave-reports")
>>> .withFormats(HTML, CONSOLE, STATS )
>>>
>>> .withCodeLocation(CodeLocations.codeLocationFromPath("build/test"))
>>> .withFailureTrace(true));
>>> injectedEmbedder().runStoriesAsPaths(storyPaths());
>>> }
>>>
>>> protected abstract List<String> storyPaths();
>>> }
>>>
>>>
>>>
>>>
>>>
>>> "Mauro Talevi" <[email protected]>
>>> wrote
>>> in message news:[email protected]...
>>>> Hi Vicki,
>>>>
>>>> can you please be more precise about what you think you can't do?
>>>>
>>>> MostUsefulConfiguration is simply a concretisation of Configuration,
>>>> providing some defaults. SeleniumConfiguration extends Configuration
>>>> with Selenium-specific elements. What you can do with
>>>> MostUsefulConfiguration you'll be able to do with
SeleniumConfiguration.
>>>>
>>>> Cheers
>>>>
>>>> On 26/05/2011 00:34, VSS wrote:
>>>>> I am trying to use the new code introduced in JBehave-413 to name
our
>>>>> screenshot files more meaningfully.
>>>>> I did try following the example laid out in Paul's tutorial site
>>>>>
https://github.com/paul-hammant/jbehave-webdriver-example/blob/master/etsy-stories/src/main/java/org/jbehave/tutorials/etsy/EtsyDotComStories.java#L42
>>>>>
>>>>> However, our framework is extending InjectableEmbedder and uses
>>>>> runStoriesAsPaths(storyPaths()). In following the code around, I
see
>>>>> that
>>>>> the Embedder class uses MostUsefulConfiguration, and there doesn't
seem
>>>>> to
>>>>> be a way to make that a SeleniumConfiguration, which, as I see it,
is
>>>>> the
>>>>> configuration I need to get the scenario name.
>>>>>
>>>>> Following Paul's example would require me to completely rewrite the
>>>>> framework, I think. Any suggestions?
>>>>>
>>>>> (PS...Hi Paul, this is Vicki from Hoover's. The framework is
Kozak's,
>>>>> so
>>>>> you've seen it, albeit many months ago) .
>>>>>
>>>>> Thanks In Advance.
>>>>> Vicki
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
---------------------------------------------------------------------
>>>>> 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
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email