0
當我運行我的測試項目時,報告按預期生成在目錄target/jbehave/view中。在報告中找不到JBehave資源
我的問題是,樣式表都沒有找到,在目錄目標/ jbehave /視圖/風格我有一個CSS jbehave.css但報告中卻產生尋找jbehave-core.css
我不「知道,如果我有一些版本問題還是其他什麼東西......
下面是我在pom.xml中使用的依賴關係:
<dependencies>
...
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<version>${jbehave.version}</version>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-spring</artifactId>
<version>${jbehave.version}</version>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-gherkin</artifactId>
<version>${jbehave.version}</version>
</dependency>
<dependency>
<groupId>org.jbehave.site</groupId>
<artifactId>jbehave-site-resources</artifactId>
<version>3.3</version>
<type>zip</type>
</dependency>
...
</dependencies>
<build>
<plugins>
...
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>${jbehave.version}</version>
<executions>
<execution>
<id>unpack-view-resources</id>
<phase>process-resources</phase>
<goals>
<goal>unpack-view-resources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
與$ {} jbehave.version 4.1 =
對於JBehave配置我使用這個類:
public class TestRunner extends JUnitStories {
@Autowired
private ApplicationContext applicationContext;
public TestRunner() {
initJBehaveConfiguration();
}
private void initJBehaveConfiguration() {
Class<?> thisClass = this.getClass();
Properties properties = new Properties();
properties.setProperty("encoding", "UTF-8");
useConfiguration(new MostUsefulConfiguration()
.useStoryLoader(new LoadFromClasspath(thisClass.getClassLoader()))
.usePendingStepStrategy(new FailingUponPendingStep())
.useStepdocReporter(new PrintStreamStepdocReporter())
.useStoryReporterBuilder(new StoryReporterBuilder()
.withCodeLocation(CodeLocations.codeLocationFromClass(thisClass))
.withDefaultFormats()
.withFormats(Format.CONSOLE, Format.TXT, Format.HTML, Format.XML, Format.STATS)
.withCrossReference(new CrossReference())
.withViewResources(properties)
.withFailureTrace(true))
.useParameterConverters(new ParameterConverters()
.addConverters(new ParameterConverters.DateConverter(new SimpleDateFormat("yyyy-MM-dd"))))
.useStoryParser(new GherkinStoryParser())
.useStepMonitor(new SilentStepMonitor()));
}
@Override
public InjectableStepsFactory stepsFactory() {
return new SpringStepsFactory(configuration(), applicationContext);
}
protected List<String> storyPaths() {
return new StoryFinder().findPaths(CodeLocations.codeLocationFromClass(this.getClass()), "**/*.story", "**/excluded*.story");
}
}