Re: Jbehave story report is not showing the time in report i.e., the Duration is shown as 00:00:00.000.
Ok, I will check. Can you send a sample zip copy of a working story with google login or Yahoo login so that I can fix issue and send it to you in couple of days On Thu, Nov 1, 2018, 7:52 PM Gajendra Sahu Hi, > > I am using *JBehave Core 4.3.5* with *JBehave Web Selenium 3.6-beta-2*. > > After debugging I found out that the code never goes inside if > (!future.isDone()) > {So it never initialized duration. Not sure what I am doing wrong. I am > only running 1 story at a time. > > public void waitUntilAllDoneOrFailed(RunContext context) { >if ( runningStories.values().isEmpty() ) { >return; >} >boolean allDone = false; >boolean started = false; >while (!allDone || !started) { >allDone = true; >for (RunningStory runningStory : runningStories.values()) { >if ( runningStory.isStarted() ){ >started = true; >Story story = runningStory.getStory(); > Future future = runningStory.getFuture(); > *if **(!future.isDone()) {* >allDone = false; >StoryDuration duration = runningStory.getDuration(); >runningStory.updateDuration(); >if (duration.timedOut()) { > embedderMonitor.storyTimeout(story, duration); > context.cancelStory(story, duration); > future.cancel(true); > if (embedderControls.failOnStoryTimeout()) { > throw new StoryExecutionFailed(story.getPath(), >new StoryTimedOut(duration)); > } > continue; >} > } else { >try { > ThrowableStory throwableStory = future.get(); > Throwable throwable = throwableStory.getThrowable(); > if (throwable != null) { > context.addFailure(story.getPath(), throwable); > if (!embedderControls.ignoreFailureInStories()) { > continue; > } > } >} catch (Throwable e) { > context.addFailure(story.getPath(), e); > if (!embedderControls.ignoreFailureInStories()) { > continue; > } >} > } >} else { >started = false; >allDone = false; >} >} >tickTock(); >} >writeStoryDurations(runningStories.values()); > } > > > public StoriesRunner() { > setBrowser(); > try { > if (lifeCycleSteps instanceof PerStoriesWebDriverSteps) { > JUnitReportingRunner.recommendedControls(configuredEmbedder()); > configuredEmbedder().useExecutorService(new > DirectExecutorService(){ > }.create( > configuredEmbedder() > .embedderControls() > .doBatch(false) > .doGenerateViewAfterStories(true) > .doIgnoreFailureInStories(false) > .doIgnoreFailureInView(false) > .doSkip(false) > .doVerboseFailures(false) > .doVerboseFiltering(false) > .useStoryTimeouts("3000") > )); > /* Required to run stories with annotated meta filters */ > > configuredEmbedder().useMetaFilters(Arrays.asList(getListOfStoriesToRun().split(","))); > } > } catch (IOException e) { > e.printStackTrace(); > } > } > > @Override > public Configuration configuration() { > Class embeddableClass = this.getClass(); > return new SeleniumConfiguration() > .useWebDriverProvider(driverProvider) > .useSeleniumContext(context) > .useStepCollector(stepCollector) > /*.useStepMonitor(new SeleniumStepMonitor(contextView, context, > new SilentStepMonitor()))*/ > .useStoryLoader(new LoadFromClasspath(embeddableClass)) > .useParameterConverters(new > ParameterConverters().addConverters(new ParameterConverters.DateConverter(new > SimpleDateFormat("-MM-dd" > .useStoryReporterBuilder(new StoryReporterBuilder() > .withCodeLocation(codeLocationFromClass(embeddableClass)) > .withDefaultFormats() > .withFormats(Format.STATS, > Format.CONSOLE, > Format.XML, > Format.TXT, > /*Format.HTML,*/ > screenShootingFormat) > .withFailureTrace(true) > ); > }
Re: Jbehave story report is not showing the time in report i.e., the Duration is shown as 00:00:00.000.
Hi, I am using *JBehave Core 4.3.5* with *JBehave Web Selenium 3.6-beta-2*. After debugging I found out that the code never goes inside if (!future.isDone()) {So it never initialized duration. Not sure what I am doing wrong. I am only running 1 story at a time. public void waitUntilAllDoneOrFailed(RunContext context) { if ( runningStories.values().isEmpty() ) { return; } boolean allDone = false; boolean started = false; while (!allDone || !started) { allDone = true; for (RunningStory runningStory : runningStories.values()) { if ( runningStory.isStarted() ){ started = true; Story story = runningStory.getStory(); Future future = runningStory.getFuture(); *if **(!future.isDone()) {* allDone = false; StoryDuration duration = runningStory.getDuration(); runningStory.updateDuration(); if (duration.timedOut()) { embedderMonitor.storyTimeout(story, duration); context.cancelStory(story, duration); future.cancel(true); if (embedderControls.failOnStoryTimeout()) { throw new StoryExecutionFailed(story.getPath(), new StoryTimedOut(duration)); } continue; } } else { try { ThrowableStory throwableStory = future.get(); Throwable throwable = throwableStory.getThrowable(); if (throwable != null) { context.addFailure(story.getPath(), throwable); if (!embedderControls.ignoreFailureInStories()) { continue; } } } catch (Throwable e) { context.addFailure(story.getPath(), e); if (!embedderControls.ignoreFailureInStories()) { continue; } } } } else { started = false; allDone = false; } } tickTock(); } writeStoryDurations(runningStories.values()); } public StoriesRunner() { setBrowser(); try { if (lifeCycleSteps instanceof PerStoriesWebDriverSteps) { JUnitReportingRunner.recommendedControls(configuredEmbedder()); configuredEmbedder().useExecutorService(new DirectExecutorService(){ }.create( configuredEmbedder() .embedderControls() .doBatch(false) .doGenerateViewAfterStories(true) .doIgnoreFailureInStories(false) .doIgnoreFailureInView(false) .doSkip(false) .doVerboseFailures(false) .doVerboseFiltering(false) .useStoryTimeouts("3000") )); /* Required to run stories with annotated meta filters */ configuredEmbedder().useMetaFilters(Arrays.asList(getListOfStoriesToRun().split(","))); } } catch (IOException e) { e.printStackTrace(); } } @Override public Configuration configuration() { Class embeddableClass = this.getClass(); return new SeleniumConfiguration() .useWebDriverProvider(driverProvider) .useSeleniumContext(context) .useStepCollector(stepCollector) /*.useStepMonitor(new SeleniumStepMonitor(contextView, context, new SilentStepMonitor()))*/ .useStoryLoader(new LoadFromClasspath(embeddableClass)) .useParameterConverters(new ParameterConverters().addConverters(new ParameterConverters.DateConverter(new SimpleDateFormat("-MM-dd" .useStoryReporterBuilder(new StoryReporterBuilder() .withCodeLocation(codeLocationFromClass(embeddableClass)) .withDefaultFormats() .withFormats(Format.STATS, Format.CONSOLE, Format.XML, Format.TXT, /*Format.HTML,*/ screenShootingFormat) .withFailureTrace(true) ); } private String getListOfStoriesToRun() throws IOException { if (System.getProperty("stories") == null) { //System.out.print(System.getProperty("story")); return readProperties.getStories(); } else { return System.getProperty("stories"); } } @Override protected List storyPaths() { return new StoryFinder().findPaths(CodeLocations.codeLocationFromPath("./src/main/resources"), "**/*.story", "");
Re: Jbehave story report is not showing the time in report i.e., the Duration is shown as 00:00:00.000.
Latest jbehave jars solved the problem On Wed, Oct 31, 2018, 10:45 PM Gajendra Sahu Any updates on this? I am facing the same issue. > > Running using JunitStories and the storyDuration.props has durations 0. > > On Friday, 23 February 2018 11:58:17 UTC-6, mauro.talevi wrote: >> >> Please package all this in a downloadable zip that can be opened and >> run. Don't forget a readme with tool versions etc >> >> On 23 Feb 2018, at 18:32, Maganti Suryanarayana murthy >> wrote: >> >> Hi Mauro Talevi, >> >> I have used gradle as a build file and please find the code base that i >> am using. I am pasing build.gradle file and apptechJbehaveStories.java >> >> Build.gradle: >> >> def buildNumber = System.getProperty('buildNumber') ?: '0' >> def buildVersion = '1.0.0-' + buildNumber >> >> version = buildVersion >> >> apply plugin: 'groovy' >> apply plugin: 'java' >> apply plugin: 'maven' >> >> >> repositories { >> mavenCentral() >>} >> >> configurations { >> jbehave >> } >> >> dependencies { >> testCompile group: 'junit', name: 'junit', version: '4.11' >> compile(group: 'org.jbehave.web', name: 'jbehave-web-selenium', >> version:'4.0-beta-1') { >> exclude(module: 'selenium-remote-control') >> exclude(module: 'selenium-java') >> exclude(module: 'jbehave-core') >> } >> compile 'org.springframework:spring-webmvc:5.0.2.RELEASE' >> compile 'org.jbehave.site:jbehave-site-resources:3.3.1' >> compile 'org.jbehave:jbehave-spring:4.1.3' >> compile 'org.jbehave:jbehave-core:4.1.3' >> compile 'log4j:log4j:1.2.16' >> compile group: 'org.seleniumhq.selenium', name: 'selenium-java', >> version: '3.7.1' >> compile group: 'commons-collections', name: 'commons-collections', >> version: '3.2.1' >> testCompile group: 'org.jbehave', name: 'jbehave-core', version: >> '4.1.3' >> compile 'org.jbehave.site:jbehave-site-resources:3.3.1:@zip' >> } >> >> /** userDefined task to copy the srories from /src/main/stories into >> build/classes/test/stories*/ >> task copyStories(type: Copy) { >> from 'src/main/resources' into "${buildDir}/classes/test" >> from 'src/main/stories' into "${buildDir}/classes/test/stories" >> } >> >> >> task copyJbehaveStyle(type: Copy) { >> from(zipTree(jarPath("jbehave-core"))) { >> include "style/*" >> } >> into("${buildDir}/classes/jbehave/view") >> } >> >> task copyJbehaveUtilities(type: Copy) { >> from(zipTree(jarPath("jbehave-site-resources"))) { >> include "js/**/*" >> include "style/**/*" >> include "images/*" >> } >> into("${buildDir}/classes/jbehave/view") >> } >> >> def jarPath(String jarName) { >> configurations.testCompile.find({ it.name.startsWith(jarName) >> }).absolutePath >> } >> >> >> /** to specify the source for java and resources for test task, by >> default this is refered to src/test folder in gradle and maven*/ >> sourceSets { >> test { >> java { >> srcDir "src/main/java" >> } >> resources { >> srcDir "src/main/resources" >> } >> } >> } >> >> test { >> systemProperty "metaFilters", System.getProperty("metaFilters", "") >> doFirst { >> copy { >> from(zipTree(jarPath("jbehave-core"))) { >> include "style/*" >> } >> into("build/reports/jbehave/view") >> >> } >> copy { >> from(zipTree(jarPath("jbehave-site-resources"))) { >> include "js/**/*" >> include "style/**/*" >> include "images/*" >> } >> into("build/reports/jbehave/view") >> } >> } >> systemProperties System.getProperties() >> dependsOn([clean,copyStories,copyJbehaveUtilities,copyJbehaveStyle]) >> } >> >> >> apptechJBehaveStories.java >> >> package com.apptech.qmo; >> >> import com.apptech.qmo.ipt.QMOHtmlOutput; >> import com.apptech.qmo.ipt.QMOStoryData; >> import com.apptech.qmo.ipt.QMOStoryReporterBuilder; >> import com.apptech.qmo.ipt.utils.Loggers; >> import com.google.common.util.concurrent.MoreExecutors; >> import org.apache.log4j.Logger; >> import org.apache.log4j.PropertyConfigurator; >> import org.jbehave.core.Embeddable; >> import org.jbehave.core.configuration.Configuration; >> import org.jbehave.core.embedder.Embedder; >> import org.jbehave.core.embedder.StoryControls; >> import org.jbehave.core.embedder.StoryTimeouts; >> import org.jbehave.core.failures.FailingUponPendingStep; >> import org.jbehave.core.failures.PendingStepStrategy; >> import org.jbehave.core.i18n.LocalizedKeywords; >> import org.jbehave.core.io.CodeLocations; >> import org.jbehave.core.io.LoadFromClasspath; >> import org.jbehave.core.io.StoryFinder; >> import org.jbehave.core.junit.JUnitStories; >> import org.jbehave.core.model.ExamplesTableFactory; >> import org.jbehave.core.model.TableTransformers; >> import org.jbehave.core.parsers.RegexStoryParser; >> import