I have a JBehave project in which need to integrate with TestNG and Selenium grid which using this, this and this code in github (sorry since i cant past the entire code so only showing the reference) i have done the JBehave + TestNG + Selenium Grid.
But my problem is when using single Story file to execute in different Selenium node the jbehave report index.html
file is shown for any one node only. I want to have separate report for each node in a single or more jbehave report index.html file. I should not run with two story files and all, how can i show separate report for each and every Selenium node in a single jbehave report html file.
I know the jbehave use freemarker for their report generation but i have no clue on how to override this and show report for each selenium nodes. Any idea please share.
Thanks in Advance.
Finally tried a way and found it to be an temporary solution for it now.
RemoteWebDriver driver = (RemoteWebDriver) DriverManager.getDriver();
String hostname = hng.getHostName(driver.getSessionId());
String browserName = driver.getCapabilities().getBrowserName();
String browserVersion = driver.getCapabilities().getVersion();
Embedder storyEmbedder = new StoryEmbedder(driver, browserName + "v" + browserVersion);
private WebDriver driver;
private static String name;
public StoryEmbedder(WebDriver driver, String hostname) {
this.driver = driver;
this.name = hostname;
}
.withRelativeDirectory(name) //where 'name' is the String variable refer above step.
return new MostUsefulConfiguration()
.useStoryControls(new StoryControls().doDryRun(false).doSkipScenariosAfterFailure(false))
.useStoryLoader(
new LoadFromClasspath(embedderClass))
.useStoryParser(
new RegexStoryParser(
examplesTableFactory))
.useStoryPathResolver(new UnderscoredCamelCaseResolver())
.useStoryReporterBuilder(
new StoryReporterBuilder().withCodeLocation(CodeLocations.codeLocationFromClass(embedderClass))
.withDefaultFormats().withPathResolver(new ResolveToPackagedName())
.withViewResources(viewResources).withReporters(new MyStoryReporter())
.withFormats(Format.CONSOLE, Format.TXT, Format.HTML, Format.XML).withFailureTrace(true)
.withFailureTraceCompression(true).withCrossReference(xref).withRelativeDirectory(name)).useParameterConverters(parameterConverters)
// use '%' instead of '$' to identify parameters
.useStepPatternParser(new RegexPrefixCapturingPatternParser("%"));
Now i can have two folders based on browser and browser version.
If you guys have any better answer please do help by posting it. Thanks in Advance.