我必须将jbehave与jenkins集成。但我不知道该怎么做。我知道我必须在Jenkins中创建一个任务,但是我不知道我应该在哪里使用jbehave来处理这个任务。
有人能帮帮我吗?
谢谢,
Sarang
发布于 2012-10-02 12:22:24
所以我假设你已经把JBehave和Maven集成起来了,对吗?可以按如下方式设置简单的构建环境:
如果希望在Jenkins中很好地呈现JBehave测试输出,还应该按照以下说明配置Jenkins/XUnit插件:http://jbehave.org/reference/stable/hudson-plugin.html
您还需要确保您的项目配置为在StoryReporterBuilder中使用XML输出格式,以使用插件(在上面的说明中没有提到)。
发布于 2012-12-18 18:41:23
您可以访问以下地址了解详细信息:
http://jbehave.org/reference/stable/hudson-plugin.html
发布于 2013-06-06 13:46:20
根据您的评论,您希望指定在使用Maven插件时通过Jenkins运行的故事。这里有一种方法:
创建StoryFinder的子类,并将其设置为Maven configuration中的storyFinderClass属性。在Jenkins命令行启动器中,您可以将stories作为-D系统属性传入,然后可以从StoryFinder中读取该属性。
命令行
mvn ... -Dcom.sarang.stories="foo.story,bar.story"Maven
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>[version]</version>
<executions>
<execution>
<id>run-stories-as-embeddables</id>
<phase>integration-test</phase>
<configuration>
...
<systemProperties>
<property>
<name>com.sarang.stories</name>
<value>${com.sarang.stories}</value>
</property>
</systemProperties>
<storyFinderClass>com.sarang.MyStoryFinder</storyFinderClass>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
...
</goals>
</execution>
</executions>
</plugin>StoryFinder
package com.sarang;
import org.jbehave.core.io.StoryFinder;
import java.util.*;
public class MyStoryFinder extends StoryFinder {
@Override
protected List<String> scan(String basedir, List<String> includes,
List<String> excludes) {
//List<String> defaultStories = super.scan(basedir, includes, excludes);
String myStories = System.getProperty("com.sarang.stories");
return Arrays.asList(myStories.split(","));
}
}https://stackoverflow.com/questions/11972696
复制相似问题