Nunit失败了单独的DLL,但可以与.nunit File一起使用
-
01-10-2019 - |
题
当我单独调用.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>
解决方案
如果将配置放入app.config并修改Nunit项目以使用该配置,则应在两种情况下使用。
运行Nunit-console-x86.exe时,它将尝试加载[myAssemblyName] .dll.config,该config应该由app.config在编译时创建。
不隶属于 StackOverflow