我的项目是标准的maven java项目。我试图将jasmine maven插件包含到我的CI中。但当我运行命令mvn clean install
时,它可以正确地运行测试。但是,如果我运行mvn jasmine:bdd
并从浏览器运行测试。我的html固定装置未加载。
这是我的项目结构。
project
|
|-src
|-main
|-test
|-java
|-javascript
|-jasmine
|-spec
|-spec.js
|-javascripts
| |-fixtures
| |-all_the_fixtures.html
|-lib
|-jasmine-jquery-1.3.1.js
这是我的pom.xml
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.2.0.0</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>
test
</goal>
</goals>
</execution>
</executions>
<configuration>
<skipTests>false</skipTests>
<jsSrcDir>${basedir}/src/main/webapp/static/js</jsSrcDir>
<jsTestSrcDir>${basedir}/src/test/java/javascript/jasmine/spec</jsTestSrcDir>
<sourceIncludes>
<include>jquery/jquery-min.js</include>
<include>src/source.js</include>
<include>src/source1.js</include>
</sourceIncludes>
<specIncludes>
<include>lib/*.js</include>
<include>**/*.js</include>
</specIncludes>
</configuration>
</plugin>
当我从浏览器运行测试时。所有html固定装置都是404。有没有办法双管齐下?
这就是我装载固定装置的方式
it("should get content group with one breadcrumb", function() {
loadFixtures("all_the_fixtures.html");
});
这是我的jasmine jquery路径配置
this.fixturesPath = 'spec/javascripts/fixtures/';
我意识到这是一个老问题,只想在这里记录我的发现。我正在努力让一些同样的东西,并运行自己。我发现,在运行bdd目标时,路径是相对于项目的基础的,而不是您创建的jasmine文件夹。这种结构可能在OP的环境中起作用。
project
|
|-spec
| |-javascripts
| |-fixtrues
| |-all_the_fixtures.html
|-src
|-main
|-test
|-java
|-javascript
|-jasmine
|-spec
|-spec.js
|-javascripts
|-lib
|-jasmine-jquery-1.3.1.js
据我所知,这是一个众所周知的问题。
这里有一篇关于如何使用个人资料解决它的帖子。基本上,您为Jasmine插件的每个目标创建一个配置文件。希望这能帮助到别人。。。