ccnet和单元测试

发布于 2024-09-05 18:01:04 字数 70 浏览 1 评论 0原文

如果项目的单元测试失败,ccnet 是否可以在 ccnet 托盘和网站中说构建失败?

有人知道这方面的教程吗?

is it possible for ccnet to say that the build has failed in the ccnet tray and the web site if a unit test fails for the project?

Anyone know of a tutorial for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

赤濁 2024-09-12 18:01:04

当然 !这就是持续集成的目标!

只需添加一个任务来在编译后运行单元测试。这在很大程度上取决于您使用的编程语言,但您可以考虑运行 EXE 进行单元测试。

总结一下,示例任务顺序:

  • 从版本控制获取源代码
  • 编译源代码
  • 编译测试
  • 运行测试
  • 报告

您要求教程,我可以给您一个例子:

  <!-- SVN implementation -->
  <sourcecontrol type="svn">
    <trunkUrl>http://dephicodetodoc.svn.sourceforge.net/svnroot/dephicodetodoc/trunk/DelphiCodeToDoc/</trunkUrl>
    <workingDirectory>$(WorkingBaseDir)\DelphiCodeToDoc</workingDirectory>
  </sourcecontrol>

  <!-- Build tasks to implement -->
  <tasks>
    <!-- Compile main application -->
    <msbuild>
      <executable>$(MSBuildPath)\MSBuild.exe</executable>
      <workingDirectory>$(WorkingBaseDir)\DelphiCodeToDoc\Source</workingDirectory>
      <projectFile>DelphiCodeToDoc.dproj</projectFile>
      <buildArgs>/target:Build /p:Config=Debug</buildArgs>
    </msbuild>

    <!-- Compile tests -->
    <msbuild>
      <executable>$(MSBuildPath)\MSBuild.exe</executable>
      <workingDirectory>$(WorkingBaseDir)\DelphiCodeToDoc\Test</workingDirectory>
      <projectFile>DelphiCodeToDoc_Tests.dproj</projectFile>
      <buildArgs>/target:Build /p:Config=XmlOutput</buildArgs>
    </msbuild>

    <!-- Execute unit tests -->
    <exec>
      <executable>$(WorkingBaseDir)\DelphiCodeToDoc\Exe\DelphiCodeToDoc_Tests.exe</executable>
      <baseDirectory>$(WorkingBaseDir)\DelphiCodeToDoc\Exe\</baseDirectory>
    </exec>

Of course ! And it is the goal for continuous integration !

Just add a task to run your unit test after compilation. It depends heavily on the programming language you use, but you can consider running the EXE for unit tests.

So to summarize, sample task order :

  • Get source from version control
  • Compile source
  • Compile tests
  • Run tests
  • Report

You ask for a tutorial, I can give you an example :

  <!-- SVN implementation -->
  <sourcecontrol type="svn">
    <trunkUrl>http://dephicodetodoc.svn.sourceforge.net/svnroot/dephicodetodoc/trunk/DelphiCodeToDoc/</trunkUrl>
    <workingDirectory>$(WorkingBaseDir)\DelphiCodeToDoc</workingDirectory>
  </sourcecontrol>

  <!-- Build tasks to implement -->
  <tasks>
    <!-- Compile main application -->
    <msbuild>
      <executable>$(MSBuildPath)\MSBuild.exe</executable>
      <workingDirectory>$(WorkingBaseDir)\DelphiCodeToDoc\Source</workingDirectory>
      <projectFile>DelphiCodeToDoc.dproj</projectFile>
      <buildArgs>/target:Build /p:Config=Debug</buildArgs>
    </msbuild>

    <!-- Compile tests -->
    <msbuild>
      <executable>$(MSBuildPath)\MSBuild.exe</executable>
      <workingDirectory>$(WorkingBaseDir)\DelphiCodeToDoc\Test</workingDirectory>
      <projectFile>DelphiCodeToDoc_Tests.dproj</projectFile>
      <buildArgs>/target:Build /p:Config=XmlOutput</buildArgs>
    </msbuild>

    <!-- Execute unit tests -->
    <exec>
      <executable>$(WorkingBaseDir)\DelphiCodeToDoc\Exe\DelphiCodeToDoc_Tests.exe</executable>
      <baseDirectory>$(WorkingBaseDir)\DelphiCodeToDoc\Exe\</baseDirectory>
    </exec>
梦冥 2024-09-12 18:01:04

这是如何使用 NUnit 设置 CCNET 的好教程:
http://ilmatte.wordpress.com/2008/06 /01/cruisecontrolnet-tutorial-part-1/

持续集成可以做更多有趣的事情。例如,使用 StyleCop 检查代码风格,使用 FxCop 查找明显的错误,使用 NDepend 跟踪依赖关系,在临时服务器上自动部署应用程序以进行手动测试,通过UI执行验收测试,进行性能测试等

This is the good tutorial how to set up CCNET with NUnit:
http://ilmatte.wordpress.com/2008/06/01/cruisecontrolnet-tutorial-part-1/

Continuous integration allows to do even more interesting things. For example check code style with StyleCop, look for obvious bugs with FxCop, track dependencies with NDepend, automatically deploy application on staging server for manual testing, perform acceptance testing through UI, do performance testing etc

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文