Frage

Ich versuche, eine einfache JUnitStory zu erstellen und betreiben eine .story Datei auszuführen.

Ich habe diese:

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;
    }
}

Mit oder ohne die Delegierten (Kopieren und in all kommentierten Methoden der MySteps Einfügen), wenn ich JBehave laufen, ich folgende Ausgabe:

somePattern(){
  // PENDING
}

Es ist wie die einzelne Geschichten nicht die Schritte abholen.

Wenn ich eine „Stories“ Klasse erstellen und alle die Geschichte von Dateien in mit storyPaths ziehen, werden die einzelnen Schritte definiert. Mit einem Debugger, ich sehe, dass candidateSteps ist sein Hit, aber es zieht nicht in den Daten er benötigt.

Was möglicherweise hier los werden könnte?

War es hilfreich?

Lösung 4

JBehave is old, underdeveloped technology. Don't use it.

Andere Tipps

You don't need to delegate to the Steps. And also you should not override candidateSteps, but rather stepsFactory. In later versions of JBehave, candidateSteps is deprecated, to make that preference for the factory method more prominent ( http://jbehave.org/reference/stable/javadoc/core/org/jbehave/core/ConfigurableEmbedder.html#candidateSteps() )

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

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

Andreas

Here is your answer buddy: The package of format has Changed.

This is the deprecated import static org.jbehave.core.reporters.StoryReporterBuilder.Format.HTML;

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

Took a while to find the answer, but was hidden on the jbehave documentation

Hope it helps! Cheers!

You shouldn't need to use the @Delegate - your JUnitStory is not your Steps class. Can you try passing in steps where you have this?

When you pass in a class that has been bytecode manipulated for Steps classes, JBehave may not see the jbehave annotations anymore.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top