Agi*_*Ace 14 javascript ant build qunit jenkins
是否可以从Jenkins执行我的QUnit(javascript)单元测试?我的构建脚本是Apache Ant.Jenkins会将其作为单独的Build Step执行,还是需要在Ant构建脚本的配置中添加一些内容?
Agi*_*Ace 18
所以,我终于设法搞清楚了.
这是我的端到端实现:
安装PhantomJS(http://phantomjs.org/) - 我在build/tools文件夹中安装了它
安装PhantomJS QUnit Runner脚本(https://gist.github.com/1588423) - 也在我的build/tools文件夹中安装
在build.xml文件中添加了以下目标:
<target name="qunit" description="runs QUnit tests using PhantomJS">
<!-- QUnit Javascript Unit Tests -->
<echo message="Executing QUnit Javascript Unit Tests..."/>
<apply executable="path-to-your-phantomjs-bin-folder/phantomjs" >
<arg value="-path-to-your-build-tools/qunit-runner.js" />
<arg line="--qunit path-to-your-qunit-folder/qunit.js --tests path-to-your-test-folder --juni path-where-you-want-to-write-the-JUnit-style-output/qunit-results.xml" />
<fileset dir="${basedir}/${dir.test}" includes="tests.js" />
<srcfile/>
</apply>
</target>
Run Code Online (Sandbox Code Playgroud)
在我的Jenkins项目配置下,我现在用"minify qunit"调用Ant
我将Jenkins指向JUnit样式的输出XML文件
而且,这是工作流程:
PS:目前,您必须手动删除JUnit类型的XML输出文件.我稍后会解决这个问题.
PS:下载定制的qunit.js(https://gist.github.com/2488794)
| 归档时间: |
|
| 查看次数: |
11025 次 |
| 最近记录: |