Global Directory
Global Directory
EXPLORE OUR SITES
London Stock Exchange Group
LSEG Data & Analytics
MyAccount
LSEG Perspectives
London Stock Exchange
FTSE Russell
LCH
Contact Us
Home
TR Internal
Setting up jBehave for a product on Foldering
Ryan Morlok
I'm trying to get jBehave working for the Rattlesnake project on Foldering, and when I try to run my tests I get the following exception:
org.jbehave.scenario.errors.BeforeOrAfterException: Method Method.overRideSessionBindingStubDefault, annotated with BeforeScenario failed.
at org.jbehave.scenario.steps.Steps$OkayToRun.run(Steps.java:338)
at org.jbehave.scenario.steps.Steps$2.perform(Steps.java:289)
at org.jbehave.scenario.ScenarioRunner$FineSoFar.run(ScenarioRunner.java:160)
at org.jbehave.scenario.ScenarioRunner.runSteps(ScenarioRunner.java:145)
at org.jbehave.scenario.ScenarioRunner.runScenarioSteps(ScenarioRunner.java:133)
at org.jbehave.scenario.ScenarioRunner.run(ScenarioRunner.java:69)
at org.jbehave.scenario.ScenarioRunner.run(ScenarioRunner.java:42)
at org.jbehave.scenario.AbstractScenario.runScenario(AbstractScenario.java:75)
at com.trgr.cobalt.foldering.jbehave.scenario.SpringContextScenario.runScenario(SpringContextScenario.java:127)
at com.trgr.cobalt.foldering.jbehave.scenario.rest.RestEndpointScenario.runScenario(RestEndpointScenario.java:43)
at com.trgr.cobalt.foldering.jbehave.scenario.SpringContextScenario.testScenario(SpringContextScenario.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:84)
at com.trgr.cobalt.foldering.EndpointTestServer.getSpringContext(EndpointTestServer.java:125)
at com.trgr.cobalt.foldering.EndpointTestServer.getBean(EndpointTestServer.java:75)
at com.trgr.cobalt.foldering.jbehave.steps.util.SessionBindingSteps.overRideSessionBindingStubDefault(SessionBindingSteps.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jbehave.scenario.steps.Steps$OkayToRun.run(Steps.java:335)
... 38 more
Does anyone know what's required to get jBehave to work on a product that pulls in platform code?
Find more posts tagged with
jbehave
refinitiv-internal
Accepted answers
Ryan Morlok
While I haven't fully resolved the issue (read: I'm on to a different stack trace), I have been able to get past this issue. The high level summary is that the jBehave tests depend on a build step to copy all the files it needs into bin/WEB-INF, and this build step isn't available by default for products.
Steps I did to resolve the issue:
* Copy WebContentAntScript.xml from Foldering/ant to RattlesnakeFoldering/ant
* Modify the WebContentAntScript.xml file to copy files from Foldering/bin to RattlesnakeFoldering/bin, then copy Rattlesnake compiled classes into RattlesnakeFoldering/bin/WEB-INF/classes
* Modify configuration settings for paths RattlesnakeFoldering/ant/ant-global.properties
* Add WebContentAntScript.xml as a build step in the RattlesnakeFoldering project
* Modify the Java Build Path settings for RattlesnakeFoldering to dump compiled test files to RattlesnakeFoldering/bin-test and set the default output folder for the rest of the target to RattlesnakeFoldering/bin/classes (from where I set the WebContentAntScript.xml to copy them to their final resting place for the jBehave tests)
All comments
Ryan Morlok
While I haven't fully resolved the issue (read: I'm on to a different stack trace), I have been able to get past this issue. The high level summary is that the jBehave tests depend on a build step to copy all the files it needs into bin/WEB-INF, and this build step isn't available by default for products.
Steps I did to resolve the issue:
* Copy WebContentAntScript.xml from Foldering/ant to RattlesnakeFoldering/ant
* Modify the WebContentAntScript.xml file to copy files from Foldering/bin to RattlesnakeFoldering/bin, then copy Rattlesnake compiled classes into RattlesnakeFoldering/bin/WEB-INF/classes
* Modify configuration settings for paths RattlesnakeFoldering/ant/ant-global.properties
* Add WebContentAntScript.xml as a build step in the RattlesnakeFoldering project
* Modify the Java Build Path settings for RattlesnakeFoldering to dump compiled test files to RattlesnakeFoldering/bin-test and set the default output folder for the rest of the target to RattlesnakeFoldering/bin/classes (from where I set the WebContentAntScript.xml to copy them to their final resting place for the jBehave tests)
Quick Links
All Forums
Recent Questions
Terms of use
Privacy & Cookie Statement
Cookies settings
Do not sell my info
Whistleblowing
UK Bribery Act
Modern Slavery Act