dig*_*tig 12 java eclipse jbehave maven
我刚刚开始学习jBehave和Maven(在Eclipse中).我已经安装了JBehave Eclipse 1.0.0.20140605-071并将其添加到我的Maven依赖项中 - pom.xml的相关位看起来像(在回复后编辑):
<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>
Run Code Online (Sandbox Code Playgroud)
这给了我一个错误:
missing artefact org.wmaop:wm-jbehave.jar:1.0.0
Run Code Online (Sandbox Code Playgroud)
如果我尝试构建我得到错误:
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]
Run Code Online (Sandbox Code Playgroud)
"使用Maven创建测试项目" 教程说"如果项目中存在错误,请打开pom.xml文件以检查是否找不到wm-jbehave依赖项.验证您的Designer是否可以访问Internet以便检索jar依赖",但我不知道这意味着什么 - 计算机当然可以访问互联网 - 我在上面打字.
我该如何解决这个错误?
我甚至不确定WM-AOP适合哪里,除了我在错误消息中提到它.
看起来你甚至不知道WM-AOP是什么:)
本教程(来自你的问题)展示了如何与他们的webMethods Designer一起启用和运行JBehave .
换句话说 - 这是一个使用另一个独立项目JBehave的独立产品(集成服务器).
要运行本教程,首先需要下载,安装和配置webMethods Designer和Integration Server Flow服务.,然后创建一个使用此服务器和JBehave在该服务器上运行测试的项目.
但是你不需要这些东西来学习JBehave.JBehave是一个独立的产品,可以在许多环境中运行,甚至可以在纯Java(JDK)中运行.
请按照以下步骤操作
2.在以下对话框中单击"下一步"
3.在下一页上键入"jbehave-simple-archetype",选择版本4.1并单击"下一步"
注意 - 不要使用最新版本4.1.1,因为它不起作用(有一个错误将在即将推出的版本4.1.2在1-2周内

4.输入项目的group-id和artifact-id,然后单击Finish

这就是全部 - 您的JBehave项目已准备就绪.
在src/main/resources/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
Run Code Online (Sandbox Code Playgroud)
在src/main/java/org/example/myJbehave/steps/你会找到MySteps.java课程.以这种方式修改它:
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");
}
}
Run Code Online (Sandbox Code Playgroud)
在/src/main/java/org/example/myJbehave/你会发现MyStories.java
这个类包含配置和引导代码用
鼠标右键单击它,然后选择"运行为/ JUnit测试",故事将被执行

您将在控制台选项卡中看到如下结果:
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)
Run Code Online (Sandbox Code Playgroud)
注意:按照以下步骤安装包含有用*.story编辑器的JBehave Eclipse插件.
据我所知,它不在 Maven 中央存储库上,所以没有 wodner,但它在 GitHub 上可用,所以让我们使用JitPack从那里获取它
将其添加到您的 POM 中
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
740 次 |
| 最近记录: |