问题
I'm trying to rerun failed tests in specflow using specflow.retry plugin https://github.com/DamirAinullin/specflow-retry
Here is my App.config file:
<?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>
I'd appreciate any help if someone gives a hint what's wrong from my side
Here is a few warning that i get on building the project:
: 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".
=
回答1:
SpecFlow.Retry only supports SpecFlow 2.*.
You can't use it with SpecFlow 3. We changed a lot in the plugin infrastructure from 2 to 3.
It looks like the plugin isn't maintained anymore, as the latest change was done more than 2 years ago.
If you want to switch unit test runner, you could switch to the SpecFlow+ Runner which has a retry feature build in. Documentation at https://docs.specflow.org/projects/specflow-runner/en/latest/Profile/Execution.html
Full Disclosure: I am the Community Manager of SpecFlow and SpecFlow+
来源:https://stackoverflow.com/questions/65586334/rerun-failed-tests-using-specflow-retry