在构建报告中合并 NUnit 和 NAnt 输出

发布于 2024-08-17 03:10:27 字数 593 浏览 2 评论 0原文

我刚刚开始使用 CruiseControl.NET,但无法理解为什么 NAnt 和 NUnit 输出的合并不起作用。我已经使用 google 上找到的典型值设置了我的 ccnet.config:

<merge>
  <files>
    <file>D:\ccnet\path1\nant-results.xml</file>
    <file>D:\ccnet\path2\TestResult.xml</file>
  </files>
</merge>
<xmllogger /> 

NAnt 和 ccnet 只工作了一半:如果我故意输入代码错误,那么 ccnet 会说构建失败。如果我故意进行失败的测试,也会发生同样的情况:ccnet 会说构建失败。

问题ViewBuildReport.aspx 页面不显示 NAnt 或 NUnit 的任何输出。

显然我一定错过了一些东西,但我不知道是什么。有什么想法吗?

I've just started using CruiseControl.NET and I'm having trouble understanding why the merging of NAnt and NUnit outputs are not working. I've setup my ccnet.config with typical values as found on google:

<merge>
  <files>
    <file>D:\ccnet\path1\nant-results.xml</file>
    <file>D:\ccnet\path2\TestResult.xml</file>
  </files>
</merge>
<xmllogger /> 

NAnt and ccnet are half working: if I deliberately put in a code error, then ccnet will say the build has failed. The same happens if I deliberately put in a failing test: ccnet will say build failed.

The problem is that the ViewBuildReport.aspx page does not show any of the output from NAnt or NUnit.

Obviously I must be missing something, but I don't know what. Any ideas?

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

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

发布评论

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

评论(3

不爱素颜 2024-08-24 03:10:27

艾伯特-我在问了一段时间后偶然找到了答案。看来这是 ccnet 的行为开箱即用。因此默认情况下它不会在 Web 仪表板中显示编译结果。

您需要找到文件 \CruiseControl.NET\webdashboard\dashboard.config 并在 buildReportBuildPlugin 部分中添加compile.xsl。添加后它看起来像这样:

<buildPlugins>
  <buildReportBuildPlugin>
    <xslFileNames>
      <xslFile>xsl\header.xsl</xslFile>
      <xslFile>xsl\unittests.xsl</xslFile>
      <xslFile>xsl\modifications.xsl</xslFile>
      <xslFile>xsl\NCoverSummary.xsl</xslFile>

      <xslFile>xsl\compile.xsl</xslFile>

    </xslFileNames>
  </buildReportBuildPlugin>
  <buildLogBuildPlugin />
  <xslReportBuildPlugin description="NCover Report" actionName="NCoverBuildReport" xslFileName="xsl\NCover.xsl"></xslReportBuildPlugin>
</buildPlugins>

文档非常糟糕,我只是在寻找其他东西时偶然发现的。我很不高兴的是,我浪费了这么多时间,而 ccnet 网站上的一些文档或示例就可以在几分钟内解决这个问题。

Albert - I found the answer by accident some time after asking. It seems that this is ccnet's behavior out of the box. So by default it does not show the compile results in the web dashboard.

You need to locate the file \CruiseControl.NET\webdashboard\dashboard.config and in the buildReportBuildPlugin section, add compile.xsl. It will look like this when added:

<buildPlugins>
  <buildReportBuildPlugin>
    <xslFileNames>
      <xslFile>xsl\header.xsl</xslFile>
      <xslFile>xsl\unittests.xsl</xslFile>
      <xslFile>xsl\modifications.xsl</xslFile>
      <xslFile>xsl\NCoverSummary.xsl</xslFile>

      <xslFile>xsl\compile.xsl</xslFile>

    </xslFileNames>
  </buildReportBuildPlugin>
  <buildLogBuildPlugin />
  <xslReportBuildPlugin description="NCover Report" actionName="NCoverBuildReport" xslFileName="xsl\NCover.xsl"></xslReportBuildPlugin>
</buildPlugins>

The documentation was extremely bad, and I only found this by accident when looking for something else. I was not happy that I wasted so much time when a little documentation or an example on the ccnet site would have solved this in minutes.

鹿童谣 2024-08-24 03:10:27

该块位于您的发布商部分吗?

这是我的一位出版商的样子:

    <publishers>
        <merge>
            <files>
                <file>*-results.xml</file>
            </files>
        </merge>
        <xmllogger />
    </publishers>

Is that block located in your publishers section?

Here's what one of my publishers looks like:

    <publishers>
        <merge>
            <files>
                <file>*-results.xml</file>
            </files>
        </merge>
        <xmllogger />
    </publishers>
半寸时光 2024-08-24 03:10:27

我错过了发布商标签,但添加它并没有解决任何问题。

从 ccnet 调用 nant 和 nunit 的最佳实践是什么?目前我有一个我不喜欢的设置:

带有 nant 任务的 ccnet,并且 nant 构建文件使用 msbuild 和 nunit2 任务来编译和测试。

很难找到 ccnet、nant 和 nunit 的合适示例来真正解释一起使用它们的最佳方法。我将 ccnet 作为服务运行,这有什么区别吗?我试图使其尽可能简单,这大致就是我正在做的事情:

ccnet.config:

<tasks>
<nant>
<baseDirectory>D:\ccnet\builds\checkout\path</baseDirectory>
<buildFile>go.build</buildFile>
<targetList>
<target>test</target>
</targetList>
</nant>
</tasks>

<publishers>
<merge>
<files>
<file>D:\ccnet\builds\artifacts\path1\nant-results.xml</file>
<file>D:\ccnet\builds\checkout\path\name.dll-results.xml</file>
</files>
</merge>
<xmllogger /> 
</publishers>

And in go.build:

<target name="build" depends="clean">
<msbuild project="name.sln">
</msbuild>
</target>

<target name="test" depends="build">
<nunit2>
<formatter type="Xml" usefile="false" />
<test assemblyname="Tests\path\name.dll" />
</nunit2>
</target>

如果我从仪表板检查构建日志,那么我可以看到它确实有nant 和 nunit 的 xml 输出。但这并没有显示在仪表板上,为什么会这样呢?这变得非常令人沮丧......

我尝试了两种不同类型的方法: auto-magic ccnet 方法(只需设置 usefile="false" 并让 ccnet 做它的事情)。这不起作用。

我还尝试了手动方法,设置 usefile="true",然后合并 nant-results.xml 和 name.dll-results.xml 文件(没有通配符,仅使用我已经三次检查的文件的确切路径。)

这根本没有任何意义

I had missed the publishers tag, but adding it did not fix anything.

What is the best practice for calling nant and nunit from ccnet? Currently I have this setup that I don't like:

ccnet with nant task, and the nant build file uses msbuild and nunit2 tasks to compile and test.

Its hard to find a decent example of ccnet, nant and nunit that really explains the best way to use them all together. I am running ccnet as a service, does that make a difference? I'm trying to keep it as simple as I can, this is roughly what I'm doing:

ccnet.config:

<tasks>
<nant>
<baseDirectory>D:\ccnet\builds\checkout\path</baseDirectory>
<buildFile>go.build</buildFile>
<targetList>
<target>test</target>
</targetList>
</nant>
</tasks>

<publishers>
<merge>
<files>
<file>D:\ccnet\builds\artifacts\path1\nant-results.xml</file>
<file>D:\ccnet\builds\checkout\path\name.dll-results.xml</file>
</files>
</merge>
<xmllogger /> 
</publishers>

And in go.build:

<target name="build" depends="clean">
<msbuild project="name.sln">
</msbuild>
</target>

<target name="test" depends="build">
<nunit2>
<formatter type="Xml" usefile="false" />
<test assemblyname="Tests\path\name.dll" />
</nunit2>
</target>

If I check the build log from the dashboard, then I can see that it does have the xml output from both nant and nunit. But this is not shown on the dashboard itself, why would that be? This is getting to be very frustrating...

I have tried two different types of approach: The auto-magic ccnet approach (just set usefile="false" and let ccnet do its thing). This did not work.

I also tried the manual approach, set usefile="true" and then merge the nant-results.xml and name.dll-results.xml files (no wildcards, just using the exact path to the file which I have triple checked.)

It just does not make any sense at all

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