Yes, to second what Alex wrote, you can run against one browser at a
time but change it at runtime or command-line.
On 18/07/2012 10:50, Alex Lehmann wrote:
You are using PropertyWebDriverProvider as web driver provider, this
supports choosing the browser by a jvm property, e.g. -Dbrowser=ie or
-Dbrowser=htmlunit
Switching between browsers in the junit is not possible I think, but
you can your test multiple times. (maybe you can set the properties in
an additional wrapper method, I haven't tried that yet)
On 18.07.2012 10:36, Paule Zaksauskiene wrote:
Hi,
I am new to JBehave, and wondering how to set up the runner class to be
able to run the tests against multiple browsers.
Could anybody post the example?
This is the example of my class, which I run as Junit test (it kicks off
the Firefox):
public class ChannelRunner extends JUnitStories {
private WebDriverProvider driverProvider = new
PropertyWebDriverProvider();
private WebDriverSteps lifecycleSteps = new
PerStoriesWebDriverSteps(driverProvider);
private Pages pages = new Pages(driverProvider);
private SeleniumContext context = new SeleniumContext();
private ContextView contextView = new LocalFrameContextView().sized(500,
100);
public ChannelRunner() {
if ( lifecycleSteps instanceof PerStoriesWebDriverSteps ){
configuredEmbedder().useExecutorService(MoreExecutors.sameThreadExecutor());
configuredEmbedder().useMetaFilters(asList("-skip"));
}
}
@Override
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()
.withCodeLocation(codeLocationFromClass(embeddableClass))
.withDefaultFormats()
.withFormats(CONSOLE, TXT, HTML, XML));
}
@Override
public InjectableStepsFactory stepsFactory() {
Configuration configuration = configuration();
return new InstanceStepsFactory(configuration,
new ChannelCreateSteps(pages),
lifecycleSteps,
new WebDriverScreenshotOnFailure(driverProvider,
configuration.storyReporterBuilder()));
}
@Override
protected List<String> storyPaths() {
return new StoryFinder()
.findPaths(codeLocationFromClass(this.getClass()).getFile(),
asList("**/*channel.story"), null);
}
public static class SameThreadEmbedder extends Embedder {
public SameThreadEmbedder() {
useExecutorService(MoreExecutors.sameThreadExecutor());
}
}
}
Thanks,
Paule Zaksauskiene,
QA Engineer
---------------------------------------------------------------------
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