I'm just getting started learning jBehave and Maven (in Eclipse). I've installed JBehave Eclipse 1.0.0.20140605-071 and added it to my Maven dependencies - the relevant bit of pom.xml looks like (edited after reply):
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wmaop</groupId>
<artifactId>wm-jbehave</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
That gives me an error:
missing artefact org.wmaop:wm-jbehave.jar:1.0.0
If I try to build I get the error:
Failure to find org.wmaop:wm-jbehave:jar:1.0.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
The "Creating a test project with Maven" tutorial says "If errors exist in the project, open the pom.xml file to check if the wm-jbehave dependency is not found. Verify that your Designer has access to the internet in order to retrieve the jar dependencies", but I don't know what that means - the computer certainly has access to the Internet - I'm typing this on it.
How do I resolve this error?
I'm not even sure where WM-AOP fits in, except that it's mentioned in the error message I get.
It seems you don't even know what WM-AOP is :)
This tutorial (from your question) shows how to enable and run JBehave together with their webMethods Designer.
In other words - this is a standalone product (integration server) that uses another standalone project JBehave
In order to run this tutorial, you need first to download, install and configure webMethods Designer & Integration Server Flow services., and then create a project that uses this server and JBehave to run tests on this server.
But you dont't need this stuff to learn JBehave. JBehave is a standalone product, which can be run in many environments, even in a pure Java (JDK).
Just follow the steps below
1. In Eclipse - click New/Maven project
2. On the following dialog Click Next
3. On the next page type in "jbehave-simple-archetype", choose version 4.1 and click next
Note - don't use the latest version 4.1.1 because it doesn't work (there is a bug which will be resolved in upcoming version 4.1.2 in 1-2 weeks
4. Enter group-id and artifact-id of your project and click Finish
That's all - your JBehave project is ready.
In src/main/resources/org/example/myJbehave/stories/
you will find my.story
with an example story:
Scenario: A scenario with some pending steps
Given I am a pending step
And I am still pending step
When a good soul will implement me
Then I shall be happy
In src/main/java/org/example/myJbehave/steps/
you will find MySteps.java
class. Modify it in this way:
import org.jbehave.core.annotations.Alias;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Then;
import org.jbehave.core.annotations.When;
public class MySteps {
@Given("I am a pending step")
@Alias("I am still pending step")
public void given_i_am_pending_step() {
System.out.println("Tihis is implementation of GIVEN");
}
@When("a good soul will implement me")
public void when_a_good_soul_will_implement_me() {
System.out.println("Tihis is implementation of WHEN");
}
@Then("I shall be happy")
public void then_i_shall_be_happy() {
System.out.println("Tihis is implementation of THEN");
}
}
In /src/main/java/org/example/myJbehave/
you will find MyStories.java
This class contains configuration & bootstrap code
Right click on it using a mouse, then choose "Run as / JUnit test" , and the story will be executed
You will see in the console tab a result like this:
Processing system properties {}
Using controls EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=true,verboseFailures=false,verboseFiltering=false,storyTimeouts=60,threads=2,failOnStoryTimeout=false]
(BeforeStories)
Running story org/example/myJbehave/stories/my.story
Tihis is implementation of GIVEN
Tihis is implementation of GIVEN
Tihis is implementation of WHEN
Tihis is implementation of THEN
(org/example/myJbehave/stories/my.story)
Scenario: A scenario with some pending steps
Given I am a pending step
And I am still pending step
When a good soul will implement me
Then I shall be happy
(AfterStories)
Generating reports view to 'C:\Users\irko\eclipse-workspace1\myJbehave\target\jbehave' using formats '[stats, console, txt, html, xml]' and view properties '{navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}'
Reports view generated with 2 stories (of which 0 pending) containing 1 scenarios (of which 0 pending)
Note: follow these steps to install JBehave Eclipse plugin which contains usefull *.story
editor.
As far as I can see it is not on Maven central repo so no wodner, but It is available on GitHub so lets fetch it from ther using JitPack
Add this to your POM
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With