你如何从 Jenkins 运行 NUnit 测试? [英] How do you run NUnit tests from Jenkins?

查看:28
本文介绍了你如何从 Jenkins 运行 NUnit 测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在每晚和每次提交到 svn 时为 C# 应用程序运行自动化 NUnit 测试.

I'm looking to run automated NUnit tests for a C# application, nightly and on each commit to svn.

这是 Jenkins-CI 可以做到的吗?
是否有在线教程或操作说明文档,其中包含我可以查看的类似设置?

Is this something that Jenkins-CI can do?
Is there an online tutorial or how-to document which documents a similar setup that I can look at?

推荐答案

我需要完全按照你的要求去做,这是我如何设置 Jenkins 来做到这一点:

I needed to do exactly what you do, here's how I setup Jenkins to do this:

  1. 将 NUnit 插件添加到 Jenkins
  2. 在您的项目中,转到配置 -> 构建 -> 添加构建步骤
  3. 在下拉列表中向下滚动到 -> 执行 Windows 批处理命令
  4. 确保此步骤位于 MSBuild 步骤之后
  5. 添加以下内容,替换变量:

单个 dll 测试:

[PathToNUnit]in unit-console.exe [PathToTestDll]Selenium.Tests.dll/xml=nunit-result.xml

[PathToNUnit]in unit-console.exe [PathToTestDll]Selenium.Tests.dll /xml=nunit-result.xml

使用 NUnit 测试项目的多个 dll 测试:

Multiple dll test using NUnit test projects:

[PathToNUnit]in unit-console.exe [PathToTests]Selenium.Tests.nunit/xml=nunit-result.xml

[PathToNUnit]in unit-console.exe [PathToTests]Selenium.Tests.nunit /xml=nunit-result.xml

  1. 构建后操作下,勾选发布 NUnit 测试结果报告
  2. 对于文本框测试报告 XML,输入 nunit-result.xml
  1. Under Post-build Actions, tick Publish NUnit test result report
  2. For the textbox Test report XMLs, enter nunit-result.xml

一旦您的项目被构建,NUIt 现在将运行并且结果将在仪表板上(如果您将鼠标悬停在天气报告图标上)或在上次测试结果下的项目页面上可见.

Once you project has been built, NUNit will now run and the results will be viewable either on the Dashboard(if you hover over the Weather report icon) or on the project page under Last Test Result.

您还可以从 Visual Studio 中或作为本地构建过程的一部分运行该命令.

You could also run the command from within Visual Studio or as part of you local build process.

这是我用来参考的两篇博文.我没有找到完全符合我要求的:
1 小时持续集成指南设置:Jenkins 遇到 .Net (2011)
使用 Hudson 构建 .NET 项目的指南(2008 年))

Here's two blog posts I used for reference. I didn't find any that fitted my requirements exactly:
1-Hour Guide to Continuous Integration Setup: Jenkins meets .Net (2011)
Guide to building .NET projects using Hudson (2008)

这篇关于你如何从 Jenkins 运行 NUnit 测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆