我最近在我的 Appium 项目中进行了一些更改,采用了新的 .Net 版本,现在我在运行 AzurePipelines 测试时遇到了问题。由于这些更改,类别过滤器不再起作用。这些与我放入 VsTest 中的测试标准一起使用,但现在不起作用。我尝试将 SourceFilter 标签添加到 yaml 文件中,但它仍然运行所有测试。 以下是声明其不会使用源过滤器的日志的一部分。
Test selector : Test assemblies
Test filter criteria : TestCategory=UserSubscription
Search folder : D:\a\r1\a
Action when minimum tests threshold not met : donothing
Minimum tests expected to be run: 0
VisualStudio version selected for test execution : latest
Attempting to find vstest.console from a visual studio installation with version [17.0,18.0).
Distributed test execution, number of agents in job : 1
Number of test cases per batch : 16
Run settings file : D:\a\r1\a\_Test.AppiumTestingOfMobileApps\AppiumTestingofmobileapps\env_ios.runsettings
Run in parallel : false
Run in isolation : false
Path to custom adapters : undefined
Other console options : undefined
Code coverage enabled : false
Diagnostics enabled : false
Rerun failed tests: true
Rerun failed tests threshold: 50
Rerun maximum attempts: 2
======================================================
Source filter: **\AppiumTesting*.dll,!**\*TestAdapter.dll,!**\obj\**
[command]D:\a\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.229.0\Modules\DTAExecutionHost.exe --inputFile D:\a\_temp\input_402b3350-9851-11ee-bab6-bf3cf2211383.json
##########################################################################
TestPlatformVersion: 17.8.0-release-23468-02
EnvironmentUri: vstest://env/POB/_apis/release/63/11933/36568/1
QueryForTaskIntervalInMilliseconds: 3000
MaxQueryForTaskIntervalInMilliseconds: 10000
QueueNotFoundDelayTimeInMilliseconds: 3000
MaxQueueNotFoundDelayTimeInMilliseconds: 50000
===========================================
Result Attachments will be stored in LogStore
Run Attachments will be stored in LogStore
TestExecutionHost.Execute: Registered TestAgent : 725 : fv-az172-118-Hosted Agent-10
Provided settings file:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<EnvironmentVariables>
<BROWSERSTACK_CONFIG_FILE>browserstack_iOS.yml</BROWSERSTACK_CONFIG_FILE>
</EnvironmentVariables>
<TestCaseFilter>TestCategory = UserSubscription</TestCaseFilter>
<TargetFrameworkVersion>net7.0</TargetFrameworkVersion>
</RunConfiguration>
</RunSettings>
Updated Run Settings:
<RunSettings>
<RunConfiguration>
<EnvironmentVariables>
<BROWSERSTACK_CONFIG_FILE>browserstack_iOS.yml</BROWSERSTACK_CONFIG_FILE>
</EnvironmentVariables>
<TestCaseFilter>TestCategory = UserSubscription</TestCaseFilter>
<TargetFrameworkVersion>net7.0</TargetFrameworkVersion>
<BatchSize>1000</BatchSize>
<ResultsDirectory>D:\a\_temp\TestResults</ResultsDirectory>
</RunConfiguration>
</RunSettings>
IsValidServiceResponse: Received None command..Service Workflow is not active
Creating run for selected test assemblies with following parameters
SourceFilter: ThisWontBeUsed TestCaseFilter: TestCategory=UserSubscription
Run title: TestRun_TestAutomationBSIntegration_Release-604
Build location: D:\a\r1\a
Build Id: 31009
Test run with Id 1059935 associated
也面临这个问题
解决方案对我有用:
Visual Studio Test
步骤设置Test filter criteria
填充
TestCategory=$(TestCategory)
TestCategory
部分填写Variables
变量的值