VSTS 生成 - 在生成的测试执行期间找不到编码的 UI 测试

VSTS Build - Coded UI Tests Could not be found during Build's Test Execution

我有一个编码 UI 测试程序,它在本地 Visual Studio (2017) 上运行时没有任何错误。程序中只有一种测试方法。它的一项功能是将文件保存在 Azure 存储容器中。在构建的测试运行过程中,构建消息表示找不到任何测试。希望得到任何反馈,看看我是否在构建定义中犯了任何错误。

构建消息说:

No test is available in D:\a\s\FullSite1\bin\Debug\FullSite1.dll D:\a\s\FullSite1\bin\Debug\Microsoft.Azure.KeyVault.Core.dll D:\a\s\FullSite1\bin\Debug\Microsoft.Data.Edm.dll D:\a\s\FullSite1\bin\Debug\Microsoft.Data.OData.dll D:\a\s\FullSite1\bin\Debug\Microsoft.Data.Services.Client.dll D:\a\s\FullSite1\bin\Debug\Microsoft.WindowsAzure.Storage.dll D:\a\s\FullSite1\bin\Debug\Newtonsoft.Json.dll D:\a\s\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll D:\a\s\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\portable-net45+wp8+wpa81+win\Microsoft.Azure.KeyVault.Core.dll D:\a\s\packages\Newtonsoft.Json.10.0.2\lib\net20\Newtonsoft.Json.dll D:\a\s\packages\Newtonsoft.Json.10.0.2\lib\net35\Newtonsoft.Json.dll D:\a\s\packages\Newtonsoft.Json.10.0.2\lib\net40\Newtonsoft.Json.dll D:\a\s\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll D:\a\s\packages\Newtonsoft.Json.10.0.2\lib\netstandard1.0\Newtonsoft.Json.dll D:\a\s\packages\Newtonsoft.Json.10.0.2\lib\netstandard1.3\Newtonsoft.Json.dll D:\a\s\packages\Newtonsoft.Json.10.0.2\lib\portable-net40+sl5+win8+wpa81+wp8\Newtonsoft.Json.dll D:\a\s\packages\Newtonsoft.Json.10.0.2\lib\portable-net45+win8+wpa81+wp8\Newtonsoft.Json.dll D:\a\s\packages\WindowsAzure.Storage.9.1.1\lib\net45\Microsoft.WindowsAzure.Storage.dll D:\a\s\packages\WindowsAzure.Storage.9.1.1\lib\netstandard1.0\Microsoft.WindowsAzure.Storage.dll D:\a\s\packages\WindowsAzure.Storage.9.1.1\lib\netstandard1.3\Microsoft.WindowsAzure.Storage.dll D:\a\s\packages\WindowsAzure.Storage.9.1.1\lib\win8\Microsoft.WindowsAzure.Storage.dll D:\a\s\packages\WindowsAzure.Storage.9.1.1\lib\wp8\Microsoft.WindowsAzure.Storage.dll D:\a\s\packages\WindowsAzure.Storage.9.1.1\lib\wpa\Microsoft.WindowsAzure.Storage.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

我在构建定义中使用以下内容:

进程

Agent queue: Hosted VS2017

Get Sources
Select a Source: TFVC

阶段 1

Agent Queue: Hosted VS2017

Demands
Exists: msbuild, visualstudio, vstest

NuGet 恢复

Version: 2
Command: restore
Path to solution, packages.config or project.json:  **/*.sln

Use packages from NuGet.org

构建解决方案 **.sln

Visual Studio Build 
Build solution **\*.sln
Version = 1.*
Solution = **\*.sln
Visual Studio Version = Latest

测试运行(Visual Studio 测试)

Version = 2.*
Select tests using = Test assemblies

Test Assemblies = **\*.dll
                  !**\*TestAdapter.dll
                  !**\obj\**
Search Folder = $(System.DefaultWorkingDirectory)

Test mix contains UI Tests

Select test platform using = Version

Update test attachments = Checked

Control Options = Enabled

将代码与另一个测试进行比较后,我发现原因是因为 CodedUITest.cs 文件在命名空间后缺少 [CodedUITest]。我已经添加了它,现在 VSTS 可以找到测试方法。