简体   繁体   English

使用 NUnit 2.5.x 和 .Net 4.0 进行持续集成/构建

[英]Continuous Integration/Builds with NUnit 2.5.x and .Net 4.0

Ok, so here's my current setup and my problem at the moment.好的,这是我目前的设置和我目前的问题。 I have a growing set of projects in a Visual Studio solution.我在Visual Studio解决方案中有越来越多的项目。 The solution contains about 15 projects (give or take a few) and a quickly growing code-base.该解决方案包含大约 15 个项目(给予或接受一些)和一个快速增长的代码库。 I realize that I should have had a continuous build system set-up before I got to this, but its never too late I suppose.我意识到在我开始之前我应该有一个连续的构建系统设置,但我想它永远不会太晚。 So after doing a little research, I believe that my perfect setup would be:所以在做了一些研究之后,我相信我的完美设置是:

  • NUnit 2.5.x (we are already tied to this... so a necessity) NUnit 2.5.x (我们已经与此联系在一起......所以有必要)
  • Integration with CruiseControl.Net (open to other options, but only free ones with Git support)CruiseControl.Net集成(对其他选项开放,但仅支持 Git 的免费选项)
  • Integration with a code-coverage tool ( NCover , DotCover ) would be nice与代码覆盖工具( NCoverDotCover )集成会很好
  • Integration to run shell commands (for JSLint and compression tools, etc.)集成运行 shell 命令(用于JSLint和压缩工具等)

What I am missing is a tool to run the automated build.我缺少的是运行自动构建的工具。 I looked at NAnt , but it's support for running MSBuild (to build the project) seemed fairly outdated (we're using VS2010 ) and utilizing the solution files in our build process would be a HUGE time saver.我查看了NAnt ,但它对运行 MSBuild (用于构建项目)的支持似乎已经过时(我们正在使用VS2010 )并且在我们的构建过程中使用解决方案文件将节省大量时间。 I also looked at MSBuild (for the obvious reasons) but the process that I found for running NUnit tests only supports 2.4.x ( MSBuild extensions project).我还查看了 MSBuild(原因很明显),但我发现运行NUnit测试的过程仅支持 2.4.x( MSBuild扩展项目)。

I am curious how everyone else has organized their continuous build systems.我很好奇其他人是如何组织他们的持续构建系统的。 NUnit if fairly popular, so I must not be the only one who is wondering about this.如果NUnit相当流行,那么我一定不是唯一对此感到疑惑的人。

my first question is how may build projects will you have?我的第一个问题是您将如何构建项目?

Teamcity Professional is free for 20 build configurations per server and will make your like sooooo much easier, has dotcover build in, and is really easy to setup, run your tests, etc. and it's by far the most fully baked CI server out there. Teamcity Professional可免费为每台服务器提供 20 种构建配置,这将使您的喜欢变得更加轻松,内置 dotcover,并且非常容易设置、运行测试等,它是迄今为止最完善的 CI 服务器。

Jenkins is the next runner up, it's a fork of Hudson and is very flexible with plugins Jenkins是下一个亚军,它是 Hudson 的一个分支,插件非常灵活
to do just about anything making it a little more flexible then Teamcity but it's not as easy to set up, code coverage is a pain to set up and has some annoying quirks, but is completely free.几乎可以做任何事情,使它比 Teamcity 更灵活一点,但设置起来并不容易,代码覆盖设置起来很痛苦,而且有一些烦人的怪癖,但它是完全免费的。

unless you have some really strong reason to use CruiseControl.Net, don't bother, for it's time it was very powerful but it's now sadly out dated and painful to use.除非您有非常充分的理由使用 CruiseControl.Net,否则请不要打扰,因为它非常强大,但遗憾的是现在它已经过时且使用起来很痛苦。

As far as setting up builds, both Teamcity and Jenkins support MSBuild, NAnt, Rake, etc. they also support multiple build steps like would do in an msbuild or Nant file.至于设置构建,Teamcity 和 Jenkins 都支持 MSBuild、NAnt、Rake 等。它们还支持多个构建步骤,就像在 msbuild 或 Nant 文件中所做的那样。 What I have done in the past is just use the.sln file to do the build with one build step, used the build in task for unit tests, then used the built in task for code coverage then used a another build task for pushing the files.我过去所做的只是使用 .sln 文件通过一个构建步骤进行构建,使用内置任务进行单元测试,然后使用内置任务进行代码覆盖,然后使用另一个构建任务推送文件。

I have used TeamCity, Jenkins, TFS, and I tried to used CruiseControl.Net but found it painfully clunky.我使用过 TeamCity、Jenkins、TFS,我尝试使用 CruiseControl.Net,但发现它非常笨拙。 By far Teamcity is the best, with Jenkins a close second, I would not willing use TFS even if I had it.到目前为止,Teamcity 是最好的,Jenkins 紧随其后,即使我拥有它,我也不愿意使用 TFS。

If you have any questions please feel free to contact me.如果您有任何问题,请随时与我联系。

You can use NAnt to build your Visual Studio 2010 solutions.您可以使用 NAnt 构建您的 Visual Studio 2010 解决方案。 I do it all the time.我一直都这样做。 I provided sample NAnt script in my answer here: <msbuild> task or msbuild.exe with NAnt?我在这里的回答中提供了示例 NAnt 脚本: <msbuild> task or msbuild.exe with NAnt?

If all you need is compile and run tests you can't go wrong with TeamCity it has great support for NUnit/VS and a bunch of reports built in.如果您只需要编译和运行测试,那么您不能 go 与TeamCity错误,它对 NUnit/VS 有很好的支持,并且内置了一堆报告。

If you need to run a more complex build script I suggest you use FinalBuilder for creating the build script and TeamCity command runner to execute that script.如果您需要运行更复杂的构建脚本,我建议您使用FinalBuilder创建构建脚本并使用 TeamCity 命令运行程序来执行该脚本。 By importing the test result into TeamCity you can still get the reports and there is a simple way to output build status from FinalBuilder to TeamCity:通过将测试结果导入 TeamCity,您仍然可以获得报告,并且有一种简单的方法将 output 构建状态从 FinalBuilder 到 TeamCity:

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

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