Skip to content

FAQ and Problems Encountered

Richard Tomlinson edited this page Mar 22, 2017 · 9 revisions
Question Answer
My stories files don't show up correctly in JUnit result Check that your story files are all uniquely named in the project. Each story file should be named ideally describing the context its testing.
My service always returns the same value and doesn't appear to be calling the mocks Check if the service being invoked by the 'When invoke' has caching enabled. If so, then you are probably seeing cached values from a previous test or shared behaviour. To successfully test you may need to temporarily change the service to disable the cache or wrap the service (eg, a cached service that just calls the service performing the work and you test that actual behaviour, ie separate the caching from the service behaviour)
My assertion/mock count is wrong The assertion (And mock) invoke count lookup uses the serviceName as a prefix rather than an exact match. This allows a combined count for all mocks or assertions within a package or a combined count where they begin with the name. Check your assertion or mock naming and see the Assertion notes for more information
When I use Then show pipeline in console I see no output Check that a log4j.properties has been added to your /src/test/resources folder, it has a stdout definition and the log level at INFO. See the page on setting up the project for the example of the log4j file.
What do I specify in the Given if there are no inputs or mocks required Given is an optional step so if there's no mock or other set up required, the first step can be a When
My tests fail with com.wm.app.b2b.server.UnknownServiceException: org.wmaop.reset:resetAdviceAndDisable Ensure the pkg-wm-aop is installed on the IS server you're connecting to in the features.properties file
Errors appear which look like they're from the remote call to the test server Check that that AOPChainProcessor is registered in the invokemanager.cnf - see the installations instructions for wm-aop
Step fails and shows "Step is pending!" Check the console tab for errors
My tests time out and fail with Connection refused: connect Your IS instance is not running on localhost or you have a different Administrator password. See the Running JBehave Tests to configure the server connection and credentials
Running the test fails with java.lang.NullPointerException at org.wmaop.flow.MockManager.reset(MockManager.java:49 Check the invokemanager.cnf file as its most likely not changed or has lost the changes (see below)
invokemanager.cnf loses the edit changes after adding the processor to it. Check the server.log for [ISS.0015.0002E] or "invokemanager.cnf" to see if class not found. If so, check paths for correct jars in correct location and typos in the class name added to invokemanager.cnf
My test has unexpectedly failed at a Then step Check for a WARN message appearing in the Console output that indicates if an exception has been caught. In this example the service invoked has an error in it. The test is not expecting an exception so the Then is checking for pipeline values that don't exist. The first line is a warning from the invoke. the second and third entry is where the test failed when it tried to look for a value. Always check for the exception warning when looking at test failures, as shown in the example below

2015-11-11 16:33:14 WARN BddTestBuilder:41 - Caught Exception while invoking [test:failure] this may not be the expected exception and could cause premature step failure.
Error is: / by zero - java.lang.ArithmeticException
2015-11-11 16:33:14 WARN JexlEngine:329 - org.wmaop.bdd.steps.PipelineJexlStep.@14![0,5]: 'value == 'hello world';' undefined variable value
2015-11-11 16:33:14 INFO BddTestBuilder:86 - Pipeline contents:
-=-=-=-=-=-=-=



Test fails with java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean Make sure you are testing for equality with == (equals) and not = (assignment)
My assertion condition fails after the service even though the pipeline should have the value Ensure the condition is checking the output from the service, not the assignment into the pipeline. See understanding of how the mocking works to revisit the principles.
What's the icon? Growing up with 80's arcade games, Galaxian was a favourite and the image is the ship you controlled. The swerving invaders remind me that defects in ones code can throw you a curve and blow up when you least want it. wmaop is here with a limitless supply of bullets to blast those critters and hit the high score.