junit4 - Unable to run the jbehave story file through junit -


i creating frame work automation testing using jbehave story files , junit running it.

pfb:

this  story file located in src/test/java/com/cdm/story/

this class file running code:

class extends junitstories

i have defined path of story file junit not able collect story execution. getting response:

org.jbehave.core.io.storyresourcenotfound: story path 'connecteddevicesmanagementpage.story' not found class loader sun.misc.launcher$appclassloader@2f0e140b     @ org.jbehave.core.io.loadfromclasspath.resourceasstream(loadfromclasspath.java:44)     @ org.jbehave.core.io.loadfromclasspath.loadresourceastext(loadfromclasspath.java:29)     @ org.jbehave.core.io.loadfromclasspath.loadstoryastext(loadfromclasspath.java:38)     @ org.jbehave.core.embedder.performabletree.storyofpath(performabletree.java:193)     @ org.jbehave.core.embedder.performabletree.addstories(performabletree.java:68)     @ org.jbehave.core.embedder.storymanager.runstories(storymanager.java:78)     @ org.jbehave.core.embedder.embedder.runstoriesaspaths(embedder.java:203)     @ com.cdm.browserfactory.browserselector.storypaths(browserselector.java:142)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)     @ java.lang.reflect.method.invoke(unknown source)     @ de.codecentric.jbehave.junit.monitoring.junitreportingrunner.getstorypathsfromjunitstories(junitreportingrunner.java:142)     @ de.codecentric.jbehave.junit.monitoring.junitreportingrunner.<init>(junitreportingrunner.java:45)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance(unknown source)     @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(unknown source)     @ java.lang.reflect.constructor.newinstance(unknown source)     @ org.junit.internal.builders.annotatedbuilder.buildrunner(annotatedbuilder.java:104)     @ org.junit.internal.builders.annotatedbuilder.runnerforclass(annotatedbuilder.java:86)     @ org.junit.runners.model.runnerbuilder.saferunnerforclass(runnerbuilder.java:59)     @ org.junit.internal.builders.alldefaultpossibilitiesbuilder.runnerforclass(alldefaultpossibilitiesbuilder.java:26)     @ org.junit.runners.model.runnerbuilder.saferunnerforclass(runnerbuilder.java:59)     @ org.junit.internal.requests.classrequest.getrunner(classrequest.java:33)     @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.<init>(junit4testreference.java:33)     @ org.eclipse.jdt.internal.junit4.runner.junit4testclassreference.<init>(junit4testclassreference.java:25)     @ org.eclipse.jdt.internal.junit4.runner.junit4testloader.createtest(junit4testloader.java:48)     @ org.eclipse.jdt.internal.junit4.runner.junit4testloader.loadtests(junit4testloader.java:38)     @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:452)     @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:683)     @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:390)     @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:197) 

if changing storypath below getting in console:

sep 23, 2016 5:43:33 pm org.openqa.selenium.remote.protocolhandshake createsession info: attempting bi-dialect session, assuming postel's law holds true on remote end 1474632816231   marionette  info    listening on port 53647 sep 23, 2016 5:43:38 pm org.openqa.selenium.remote.protocolhandshake createsession info: detected dialect: w3c processing system properties {} using controls embeddercontrols[batch=false,skip=false,generateviewafterstories=true,ignorefailureinstories=false,ignorefailureinview=false,verbosefailures=false,verbosefiltering=false,storytimeoutinsecs=300,threads=1]  (beforestories)   (afterstories)  generating reports view 'c:\users\cmd_automation\cdm_automatiom\target\jbehave' using formats '[stats, console, txt, junitscenarioreporter]' , view properties '{reports=ftl/jbehave-reports-with-totals.ftl, decoratenonhtml=true}' reports view generated 0 stories (of 0 pending) containing 0 scenarios (of 0 pending) 

i have stuck 2 days, trying lot of things google unable solve yet..please me resolve this.

first, update jbehave core 4.0 4.0.5 since junit runner using reflection work.

then, in storypaths method no need call embedder.runstoriesaspaths, called run method.

just add in storypaths method:

@override public list<string> storypaths() {     list<string> stories = new storyfinder().findpaths(             codelocationfromclass(this.getclass()), "**/*.story", "**/excluded*.story");     return stories; } 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -