当我尝试使用下面的命令运行Stryker时,它失败了,说它找不到.csproj文件。但是,该文件存在于配置的位置:
C:\Users\Me\Documents\git\my_pkg>dotnet stryker --solution-path ".\My.Project.sln" --test-runner DotnetTest --project-file ".\test\My.Project.Tests\My.Project.Tests.csproj"
_____ _ _ _ _ ______ _______
/ ____| | | | | \ | | ____|__ __|
| (___ | |_ _ __ _ _| | _____ _ __ | \| | |__ | |
\___ \| __| '__| | | | |/ / _ \ '__| | . ` | __| | |
____) | |_| | | |_| | < __/ | | |\ | |____ | |
|_____/ \__|_| \__, |_|\_\___|_| (_)|_| \_|______| |_|
__/ |
|___/
Version: 0.20.0 (beta)
[10:41:49 INF] Time Elapsed 00:00:00.8016192
Stryker.NET failed to mutate your project. For more information see the logs below:
No .csproj file found, please check your project directory at C:\Users\Me\Documents\git\my_pkg为什么文件找不到?
发布于 2021-01-07 14:14:37
-项目-文件应该指向您想要变异的项目,而不是单元测试项目。也就是说,如果My.Project.csproj是您要测试的项目,而My.Project.Tests.csproj是伴随的单元测试,那么我通常要做的是导航到包含My.Project.Tests.csproj的文件夹,然后从命令行运行dotnet stryker。如果My.Project.Tests.csproj中只有一个项目引用,就会自动检测到它,而Stryker将尝试创建变体来检查您的单元测试项目。如果My.Project.Tests.csproj文件中有多个项目引用,那么您将被要求通过传递-- project来澄清您打算突变的项目。
就我个人而言,我将在单元测试项目的根中创建一个stryker-config.json,如下所示:https://github.com/stryker-mutator/stryker-net/blob/master/docs/Configuration.md
你可能想要这样的东西:
{
"stryker-config": {
"reporters": [
"progress",
"html"
],
"log-level": "info",
"log-file": true,
"timeout-ms": 10000,
"project-file": "My.Project.csproj",
"max-concurrent-test-runners": 4,
"threshold-high": 80,
"threshold-low": 70,
"threshold-break": 60,
"mutation-level": "Standard",
"excluded-mutations": [
"string"
],
"dashboard-compare": false
}
}假设在单元测试项目中引用了My.Project.csproj。
https://stackoverflow.com/questions/65142131
复制相似问题