使用 NUnit3 测试多个程序集
Test multiple Assemblies with NUnit3
我想用 nunit3 测试多个 Assemblypath。这在 nunit 2.x 中很容易,但因为我有 nunit 3.2,所以它不起作用。
我的代码看起来是这样的:
[string]$path= "C:\CMI\Entwicklung\MetaTool\.build\temp\_PublishedNUnitTests\CMI.Server.DirectImport.Tests\CMI.Server.DirectImport.Tests.dll, C:\CMI\Entwicklung\MetaTool\.build\temp\_PublishedNUnitTests\CMI.Server.DirectImport.Tests\CMI.Server.DirectImport.Tests.dll"
& $nunitExe $path -work "$NUnitTestResultsDirectory\NUnit.xml" -noheader
当我 运行 这个脚本时出现错误,告诉我路径不是有效路径。
您需要创建一个 NUnit 项目文件 (.nunit)。您可以在那里列出多个 dll 和一些其他设置。在这里查看操作方法:http://nunit.org/index.php?p=projectEditor&r=2.6.4 还没有 NUnit 3 的文档。
项目文件可以,但不是必需的。您只需要传递以空格分隔的路径,而不是逗号。
[string]$path1="C:\CMI\Entwicklung\MetaTool\.build\temp\_PublishedNUnitTests\CMI.Server.DirectImport.Tests\CMI.Server.DirectImport.Tests.dll"
[string]$path2="C:\CMI\Entwicklung\MetaTool\.build\temp\_PublishedNUnitTests\CMI.Server.DirectImport.Tests\CMI.Server.DirectImport.Tests.dll"
& $nunitExe $path1 $path2 -work "$NUnitTestResultsDirectory\NUnit.xml" -noheader
我想用 nunit3 测试多个 Assemblypath。这在 nunit 2.x 中很容易,但因为我有 nunit 3.2,所以它不起作用。
我的代码看起来是这样的:
[string]$path= "C:\CMI\Entwicklung\MetaTool\.build\temp\_PublishedNUnitTests\CMI.Server.DirectImport.Tests\CMI.Server.DirectImport.Tests.dll, C:\CMI\Entwicklung\MetaTool\.build\temp\_PublishedNUnitTests\CMI.Server.DirectImport.Tests\CMI.Server.DirectImport.Tests.dll"
& $nunitExe $path -work "$NUnitTestResultsDirectory\NUnit.xml" -noheader
当我 运行 这个脚本时出现错误,告诉我路径不是有效路径。
您需要创建一个 NUnit 项目文件 (.nunit)。您可以在那里列出多个 dll 和一些其他设置。在这里查看操作方法:http://nunit.org/index.php?p=projectEditor&r=2.6.4 还没有 NUnit 3 的文档。
项目文件可以,但不是必需的。您只需要传递以空格分隔的路径,而不是逗号。
[string]$path1="C:\CMI\Entwicklung\MetaTool\.build\temp\_PublishedNUnitTests\CMI.Server.DirectImport.Tests\CMI.Server.DirectImport.Tests.dll"
[string]$path2="C:\CMI\Entwicklung\MetaTool\.build\temp\_PublishedNUnitTests\CMI.Server.DirectImport.Tests\CMI.Server.DirectImport.Tests.dll"
& $nunitExe $path1 $path2 -work "$NUnitTestResultsDirectory\NUnit.xml" -noheader