【发布时间】:2021-01-05 20:47:10
【问题描述】:
我正在尝试使用 specflow.retry 插件 https://github.com/DamirAinullin/specflow-retry 在 specflow 中重新运行失败的测试
这是我的 App.config 文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<unitTestProvider name="nUnit" />
<plugins>
<add name="SpecFlow.Retry.Generator" path="..\packages\SpecFlow.Retry.2.4.0\lib\net45" type="Generator" />
</plugins>
</configuration>
如果有人提示我的问题所在,我将不胜感激
这是我在构建项目时得到的一些警告:
: warning NU1608: Detected package version outside of dependency constraint: SpecFlow.CustomPlugin 2.4.0 requires SpecFlow (= 2.4.0) but version SpecFlow 3.3.74 was resolved.
warning NU1701: Package 'FluentAssert 1.0.0.11' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
: warning NU1701: Package 'SpecFlow.Retry 2.4.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2081,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Users\me\.nuget\packages\magick.net-q16-x64\7.21.1\lib\netstandard20\Magick.NET-Q16-x64.dll", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
: warning CS0618: 'ScenarioContext.Current' is obsolete: 'Please get the ScenarioContext via Context Injection - https://www.specflow.org/documentation/Context-Injection/'
: warning CS0618: 'ScenarioContext.Current' is obsolete: 'Please get the ScenarioContext via Context Injection - https://www.specflow.org/documentation/Context-Injection/'
>Done building project "TestAutomation.UI.Tests.csproj".
=
【问题讨论】:
-
您遇到错误了吗?我们知道预期的行为(重试测试),但您观察到的实际行为是什么?
-
测试失败后不重试。它只执行一次。场景标记有@retry标签
-
您的项目针对的是哪个版本的 .NET?我在您的屏幕截图中看到一些 NuGet 包旁边的黄色三角形图标。这让我想知道这是否是一个兼容性问题。
-
我使用的是 .NET Core 3.1
-
您在构建解决方案时是否收到任何警告?如果是这样,请将这些添加到您的问题中。