1

无法弄清楚为什么当我单独调用 .dll 文件时我的 nunit 测试失败但是当我通过 nunit-console-x86.exe 调用下面的 .nunit 文件时

我怀疑它与配置文件有关。其中一些测试需要此配置文件中的配置信息。有些没有,似乎那些没有通过的。

有没有办法告诉 nunit-console.exe 在加载单个 dll 时使用配置文件?命令行参数中没有任何内容表明这是可能的,这让我只需要定义一个新的配置部分,其中只包含我想要运行的测试子集。

<NUnitProject>
  <Settings activeconfig="Debug" />
  <Config name="Debug" appbase="..\UnitTest" configfile="Local.config" binpathtype="Auto">
      <assembly path=".\bin\Debug\UnitTest.dll" />
      <assembly path=".\bin\Debug\DBUnitTests.dll"/>
      <assembly path=".\bin\Debug\Processors.dll"/>
  </Config>
  <Config name="Release" binpathtype="Auto">
    <assembly path=".\bin\Release\UnitTest.dll" />
  </Config>
</NUnitProject>
4

1 回答 1

0

如果您将配置放在 app.config 中并修改 NUnit 项目以使用它,那么它应该适用于这两种情况。

运行 nunit-console-x86.exe 时,它​​会尝试加载 [MyAssemblyName].dll.config,它应该由 VS 在编译时从 app.config 创建。

于 2010-07-01T20:04:17.087 回答