In my Powershell script (PSAKE), I have the ability to specify the Namespace/Fixture to run when I execute the NUnit test runner.
在我的Powershell脚本(PSAKE)中,我有能力在执行NUnit测试运行器时指定要运行的名称空间/Fixture。
task UnitTest -Depends Compile -Description "Runs only Unit Tests" {
Invoke-Nunit "$buildOutputDir\$testAssembly.dll" "$testAssembly.Unit" $buildArtifactsDir
}
task IntegrationTest -Depends Compile -Description "Runs only Integration Tests" {
Invoke-Nunit "$buildOutputDir\$testAssembly.dll" "$testAssembly.Integration" $buildArtifactsDir
}
task FunctionalTest -Depends Compile -Description "Runs only Functional Tests" {
Invoke-Nunit "$buildOutputDir\$testAssembly.dll" "$testAssembly.Functional" $buildArtifactsDir
}
This allows me to have three outputs
这允许我有三个输出。
Unit-TestResults.xml
Integration-TestResults.xml
Functional-TestResults.xml
I'm in the process of switching over to FAKE because it's just so much cleaner to maintain, however I can't figure out how to specify the Fixture for my test.
我正在转换为假,因为它是如此的清洁维护,但是我不知道如何为我的测试指定夹具。
IE: right now I have
IE:现在我有。
// Run Tests
Target "Tests" (fun _ ->
testDlls
|> NUnit (fun p ->
{p with
DisableShadowCopy = true;
OutputFile = artifactDir + "/TestResults.xml"
})
)
But this runs ALL the tests and drops it into a single output. I'd really like to specify the Fixture, and be able to split it all up. Is there a way to do this?
但是,这将运行所有的测试并将其放入一个输出中。我真的很想指定夹具,并且可以把它分开。有没有办法做到这一点?
1 个解决方案
#1
1
Newest version of FAKE added support for Fixture parameter. You should be able to do:
最新版本的假添加对夹具参数的支持。你应该能够做到:
Target "Tests" (fun _ ->
testDlls
|> NUnit (fun p ->
{p with
Fixture ="Namespace.Unit"
DisableShadowCopy = true;
OutputFile = artifactDir + "/Unit-TestResults.xml"
})
testDlls
|> NUnit (fun p ->
{p with
Fixture ="Namespace.Integration"
DisableShadowCopy = true;
OutputFile = artifactDir + "/Integration-TestResults.xml"
})
testDlls
|> NUnit (fun p ->
{p with
Fixture ="Namespace.Functional"
DisableShadowCopy = true;
OutputFile = artifactDir + "/Functional-TestResults.xml"
})
)
#1
1
Newest version of FAKE added support for Fixture parameter. You should be able to do:
最新版本的假添加对夹具参数的支持。你应该能够做到:
Target "Tests" (fun _ ->
testDlls
|> NUnit (fun p ->
{p with
Fixture ="Namespace.Unit"
DisableShadowCopy = true;
OutputFile = artifactDir + "/Unit-TestResults.xml"
})
testDlls
|> NUnit (fun p ->
{p with
Fixture ="Namespace.Integration"
DisableShadowCopy = true;
OutputFile = artifactDir + "/Integration-TestResults.xml"
})
testDlls
|> NUnit (fun p ->
{p with
Fixture ="Namespace.Functional"
DisableShadowCopy = true;
OutputFile = artifactDir + "/Functional-TestResults.xml"
})
)