简体   繁体   English

使用Jenkins在NodeJS上运行单元测试

[英]Running Unit Tests on NodeJS with Jenkins

How might I setup Jenkins to start my Node.JS Testing Server, run Unit Test probably JSTestDriver/Jasmine, and then top Node.JS? 我如何设置Jenkins来启动我的Node.JS测试服务器,运行Unit Test可能是JSTestDriver / Jasmine,然后是顶级Node.JS?

I can start Node.JS using Execute Shell, but it "hangs" the build (expected since Node runs as a daemon) 我可以使用Execute Shell启动Node.JS,但它“挂起”构建(预期Node作为守护进程运行)

I've written an article that explains how I've managed to run my unit tests with Mocha and ant. 我写了一篇文章解释了我是如何设法用Mocha和ant运行我的单元测试的。

The basic idea is: 基本思路是:

  • Set your environment variables so that jenkins can control them 设置环境变量,以便jenkins可以控制它们
  • Use mocha's xunit reporter to generate a result report 使用mocha的xunit报告器生成结果报告
  • Use Jenkins' Publish JUnit test result report option to read the result report. 使用Jenkins的Publish JUnit测试结果报告选项来读取结果报告。

You can read the full article here . 你可以在这里阅读完整的文章

JSTestDriver outputs it's results in a xUnit compliant xml format. JSTestDriver以xUnit兼容的xml格式输出结果。 Which the Hudson 'xUnit' plugin can then interpret. 然后Hudson'xUnit'插件可以解释。

We are planning to integrate jsTestDriver into Jenkins. 我们计划将jsTestDriver集成到Jenkins中。 To test our javaScript code in a selection of supported browsers. 在一系列支持的浏览器中测试我们的javaScript代码。

there is a plugin to execute nodejs with possibility to choice the nodejs version 有一个插件可以执行nodejs,可以选择nodejs版本

https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM