JBehave - all steps marked pending?

I am trying to create and run a simple JUnitStory to run a .story file.

I have it:

class Scenario1 extends JUnitStory { @Delegate MySteps steps = new MySteps() @Override public Configuration configuration() { return new MostUsefulConfiguration() .useStoryLoader(new LoadFromRelativeFile(new File('src/test/groovy').toURL())) .useStoryReporterBuilder( new StoryReporterBuilder() .withDefaultFormats() .withFormats(Format.HTML, Format.CONSOLE, Format.TXT) ); } @Override public List candidateSteps() { final candidateSteps = new InstanceStepsFactory(configuration(), this).createCandidateSteps() return candidateSteps; } } 

With or without a delegate (copying and pasting all annotated MySteps methods), whenever I run JBehave, I get the following output:

 somePattern(){ // PENDING } 

This is similar to individual stories that do not take steps.

When I create the Stories class and pull out all the story files using storyPaths , the individual steps are defined. Using the debugger, I see that hitSteps hits, but it does not pull the data it needs.

What could be here?

+7
source share
4 answers

JBehave is an old, undeveloped technology. Do not use it.

-5
source

You do not need to delegate steps. And also you should not redefine the Steps candidates, but rather stepFactory. In later versions of JBehave, the Steps candidate is deprecated to make this preference for the factory method more prominent ( http://jbehave.org/reference/stable/javadoc/core/org/jbehave/core/ConfigurableEmbedder.html#candidateSteps ())

See this blog post where I explained how the basic configuration of JBehave works in more detail:

http://blog.codecentric.de/en/2012/06/jbehave-configuration-tutorial/

Andreas

+2
source

Here is your interlocutor: The format package has been changed.

This is an obsolete import static org.jbehave.core.reporters.StoryReporterBuilder.Format.HTML;

This is new :) import static org.jbehave.core.reporters.Format.HTML;

Took time to find the answer but was hidden in jbehave documentation

Hope this helps! Hooray!

+1
source

You do not need to use @Delegate - your JUnitStory is not your Steps class. Can you try the steps when you have it?

When you pass a class whose bytecode is used for Steps classes, JBehave can no longer see jbehave annotations.

0
source

All Articles