在我们的持续集成设置中,我想设置 CruisControl.NET 来自动运行我们所有的单元测试。但是,我不想在配置中单独指定每个 unittest dll。
所有单元测试项目都带有后缀.Test
(所有非单元测试项目都没有)。如何配置 CruiseControl.NET 以运行这些项目中的所有单元测试(我使用的是 CruiseControl.NET v1.5.7256.1)?
我当前的配置尝试:
<nunit>
<path>$(nunit.path)</path>
<assemblies>
<assembly>$(working.dir)\**\*.Test.dll</assembly>
</assemblies>
</nunit>
我发现很难找到有关此特定 nunit 元素的文档。我能找到的大多数页面都在谈论使用exec、nunit2或其他nunit元素或nunit-console 命令行选项。
我在管理构建环境方面没有太多经验,并且正在处理现有配置,其中每个程序集都以下列方式单独指定。
<nunit>
<path>$(nunit.path)</path>
<assemblies>
<assembly>$(artifact.dir)\test1.dll</assembly>
<assembly>$(artifact.dir)\test2.dll</assembly>
</assemblies>
</nunit>
因此,我尝试使用通配符失败。
编辑:
这是我的配置文件的一些额外 xml,用于稍微显示上下文:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<project name="MyProject">
<!-- whole bunch of other elements -->
<tasks>
<nunit>
<!-- see above -->
</nunit>
</tasks>
</project>
</cruiscontrol>
在 Mightmuke 的建议之后,我尝试用<nunit>
他的建议替换元素,但得到以下异常:Unable to instantiate CruiseControl projects from configuration document. Configuration document is likely missing Xml nodes required for properly populating CruiseControl configuration. Unable to load array item 'property' - Cannot convert from type System.String to ThoughtWorks.CruiseControl.Core.ITask for object with value: ""
然后我尝试将<property>
and元素移到<foreach>
元素之外。然后我得到了异常:Unused node detected: <property name="nunit.filelist" value="" />
我现在正试图找出有关该<foreach>
元素的更多信息以及我可以把它放在哪里,但不知何故,我发现很难找到任何关于它的文档。
编辑2:
我找到了我正在使用的 nunit 任务的文档:http: //ccnet.sourceforge.net/CCNET/NUnit%20Task.html
我将元素指定为 String[] 类型。我不确定这意味着什么......但从示例中可以看出它只是意味着它必须包含单数形式的同名子元素列表。
PS:我意识到这个问题有点失控......当整个事情解决后,我会尝试以这种格式编辑它,以便以后对其他人有用。