你如何从 Jenkins 运行 NUnit 测试?

编程入门 行业动态 更新时间:2024-10-22 10:42:56
本文介绍了你如何从 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:

  • 将 NUnit 插件添加到 Jenkins
  • 在您的项目中,转到配置 -> 构建 -> 添加构建步骤
  • 在下拉列表中向下滚动到 -> 执行 Windows 批处理命令
  • 确保此步骤位于 MSBuild 步骤之后
  • 添加以下内容,替换变量:
  • 单个 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

  • 在构建后操作下,勾选发布 NUnit 测试结果报告
  • 对于文本框测试报告 XML,输入 nunit-result.xml
  • Under Post-build Actions, tick Publish NUnit test result report
  • 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 测试?

    本文发布于:2023-11-17 07:19:51,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1609280.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:测试   Jenkins   NUnit

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!