在 Azure DevOps 管道中失败测试 运行 成功
Failing test running successful in Azure DevOps Pipeline
我有一个 ASP.NET Web 表单项目,该项目托管在 Azure DevOps 存储库上。源代码管理是 TFS。
我在 Azure Devops 中为存储库创建了一个持续集成管道。
这是管道的图像:
管道中的所有任务都 运行 正确地位于 VSTest-TestAssemblies
任务旁边。
我的 NUnit 测试在我的本地 Visual Studio 中失败了:
但是当 运行 我的 CI 时,它告诉我没有测试失败:
在这里你可以看到我的设置和我对 VSTest-TestAssemblies
任务的测试路径:
这是我的项目的文件夹结构:
NR.TestAutomation
- NR.TestAutomation
- NR.TestAutomation.Tests
- bin
- obj
- DemoTests.cs
- NR.TestAutomation.Tests.csproj
- packages
- NR.TestsAutomation.sln
CI 运行 的输出告诉我,该文件夹存在并且它甚至找到了测试:
Source filter: **/*Tests/*.cs
SystemVssConnection exists true
vstest.console.exe "D:\a\s\NR.TestAutomation.Tests\DemoTests.cs"
为什么我失败的测试在 Azure DevOps 管道中没有失败?
您应该将 TestProject 的(输出)指定为 运行,而不是包含测试的单个文件。测试 运行ner 无法执行 .cs file
.
简而言之;失败的测试在 Azure DevOps 管道中没有 运行 成功...它 根本没有 运行 在管道中 .
Test files
Run tests from the specified files. Ordered tests and webtests can be run by specifying the .orderedtest
and .webtest
files respectively. To run .webtest
, Visual Studio 2017 Update 4 or higher is needed. The file paths are relative to the search folder. Supports multiple lines of minimatch patterns.
来源Visual Studio Test task - Arguments
可能也很有趣:有关 File matching patterns reference
的更多信息
编辑:
what would be the proper Source Path to my tests?
当然这取决于您的测试项目的名称。查看您的屏幕截图,您可以使用 **/*.Tests.dll
。这将递归匹配名称以 .Tests.dll
.
结尾的所有程序集
由于您的项目名称是 NR.TestAutomation.Tests
,程序集应命名为 NR.TestAutomation.Tests.dll
以便匹配。它还为将来添加的测试项目做好了准备,只要它们的名称以 .Tests
.
结尾即可
我有一个 ASP.NET Web 表单项目,该项目托管在 Azure DevOps 存储库上。源代码管理是 TFS。
我在 Azure Devops 中为存储库创建了一个持续集成管道。 这是管道的图像:
管道中的所有任务都 运行 正确地位于 VSTest-TestAssemblies
任务旁边。
我的 NUnit 测试在我的本地 Visual Studio 中失败了:
但是当 运行 我的 CI 时,它告诉我没有测试失败:
在这里你可以看到我的设置和我对 VSTest-TestAssemblies
任务的测试路径:
这是我的项目的文件夹结构:
NR.TestAutomation
- NR.TestAutomation
- NR.TestAutomation.Tests
- bin
- obj
- DemoTests.cs
- NR.TestAutomation.Tests.csproj
- packages
- NR.TestsAutomation.sln
CI 运行 的输出告诉我,该文件夹存在并且它甚至找到了测试:
Source filter: **/*Tests/*.cs
SystemVssConnection exists true
vstest.console.exe "D:\a\s\NR.TestAutomation.Tests\DemoTests.cs"
为什么我失败的测试在 Azure DevOps 管道中没有失败?
您应该将 TestProject 的(输出)指定为 运行,而不是包含测试的单个文件。测试 运行ner 无法执行 .cs file
.
简而言之;失败的测试在 Azure DevOps 管道中没有 运行 成功...它 根本没有 运行 在管道中 .
Test files
Run tests from the specified files. Ordered tests and webtests can be run by specifying the.orderedtest
and.webtest
files respectively. To run.webtest
, Visual Studio 2017 Update 4 or higher is needed. The file paths are relative to the search folder. Supports multiple lines of minimatch patterns.
来源Visual Studio Test task - Arguments
可能也很有趣:有关 File matching patterns reference
的更多信息编辑:
what would be the proper Source Path to my tests?
当然这取决于您的测试项目的名称。查看您的屏幕截图,您可以使用 **/*.Tests.dll
。这将递归匹配名称以 .Tests.dll
.
结尾的所有程序集
由于您的项目名称是 NR.TestAutomation.Tests
,程序集应命名为 NR.TestAutomation.Tests.dll
以便匹配。它还为将来添加的测试项目做好了准备,只要它们的名称以 .Tests
.