-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SpecFlow tests fail on retry in Azure Pipeline #2213
Comments
Ah, you are using NUnit. Interesting, as we use only features that are normally available. Probably the It would only be a bug in the FullQualifiedName that we could fix, if you would have used the SpecFlow+ Runner. |
Hi Andreas,
Thanks - I'll take a look ...
…On 2020-11-18 04:54, Andreas Willich wrote:
Ah, you are using NUnit. Interesting, as we use only features that are
normally available.
We use the normal Test and TestCase attributes.
Probably the Agriculture & Rural is the problem in the command line.
That & is not escaped. Could you change that to something else?
It would only be a bug in the FullQualifiedName that we could fix, if
you would have used the SpecFlow+ Runner.
--
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
Links:
------
[1]
#2213 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/ADC7VEUXG2EEUTUJBJX7VCTSQORWHANCNFSM4TZQPOYA
|
Hello, I'm on Chris's team in developing these tests. QuestionWhat do you mean by normally available?
When I look at the nuget packages i see this is the most common runner used for specflow. Additional test casesAlso I have run tests without the & symbol in our parameters. I think the issue is because the scenario outline adds parenthesis to the test name and those don't get escaped.
Screenshot of Test in Azure Devops There is a different error if we have a space in our parameter.
Resolution I'm seekingFrom all my analysis I think the issue boils down to when we try to retry the tests in Azure devops it puts the FullyQualifiedName of all failed tests into the TestCaseFilter parameter, and when a test from a scenario outline fails we get an error. I believe it is because the test name generated from specflow places parenthesis in the test name and those don't get escaped. Essentially, we want to know if there is some way to configure or change the naming schema for scenario outlines to not include these parenthesis and use '_' or something instead. I have already met extensively with Microsoft to see if they could resolve this in the VSTest task but found no solution. I think we would have the same problem with specflow+Runner unless it results in a different naming convention for the tests. |
@ryandorendorf SpecFlow supports xUnit, NUnit, SpecFlow+ Runner and MSTest. That NUnit is the most downloaded NuGet package, but that changes nothing. We are supporting all of them. What SpecFlow does is at compile time to generate out of the feature files a code-behind file (the feature.cs- files). And there we are using dependent on the test runner, different attributes, that are you also use when you write unit tests. I tried to reproduce the issue and I was successful. When you look at the generated code for this scenario Scenario Outline: Add two numbers
Given the first number is 50
And the second number is 70
When the two numbers are added
Then the result should be 120
Examples:
| Column |
| Spa ces |
| Amp&ersam |
| Spaces & Ampersam | we generate this code (https://github.com/SabotageAndi/NUnitRetry2213/blob/master/NUnitRetry2213/Features/Calculator.feature.cs#L82) [NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Add two numbers")]
[NUnit.Framework.CategoryAttribute("mytag")]
[NUnit.Framework.TestCaseAttribute("Spa ces", null)]
[NUnit.Framework.TestCaseAttribute("Amp&ersam", null)]
[NUnit.Framework.TestCaseAttribute("Spaces & Ampersam", null)]
public virtual void AddTwoNumbers(string column, string[] exampleTags) I think this correct generated. The first parameter is a string. If we (as SpecFlow) would start escaping this, you will get it also so as a parameter in your bindings. So I created a GitHub issue for the NUnit Testadapter (nunit/nunit3-vs-adapter#807). Let see what the NUnit people say about this. |
@ryandorendorf |
Hi SpecFlow Community,
Andreas Willich recommended that we post a bug here ...
"Please create an issue at github.com/SpecFlowOSS/SpecFlow I think our FullyQualifiedName Generation has a bug. – Andreas Willich" -- https://stackoverflow.com/questions/64851698/specflow-tests-fail-on-retry-in-azure-pipeline
We are running SpecFlow tests ina CI/CD Azure Pipeline. The SpecFlow Scenario Outline tests are failing during the Azure Pipeline Retry Process.
We are using the following environment.
SpecFlow (3.4.14)
SpecFlow.NUnit (3.4.14)
Nunit.ConsoleRunner (3.11.1)
Azure Pipeline (using VSTest)
SpecFlow Version:
Used Test Runner
Version number: Nunit.ConsoleRunner (3.11.1)
Project Format of the SpecFlow project
packages.config
<PackageReference>
tags.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation
NuGet packageSpecFlowSingleFileGenerator
custom toolVisual Studio Version
Enable SpecFlowSingleFileGenerator Custom Tool
option in Visual Studio extension settingsAre the latest Visual Studio updates installed?
<Major>.<Minor>.<Patch>
.NET Framework:
Test Execution Method:
vstest.console.exe /TestCaseFilter:"FullyQualifiedName ... (See attached log for more info)
<SpecFlow> Section in app.config or content of specflow.json
Issue Description
Hi SpecFlow Community,
We are running SpecFlow tests ina CI/CD Azure Pipeline. The SpecFlow Scenario Outline tests are failing during the Azure Pipeline Retry Process.
We are using the following environment.
SpecFlow (3.4.14)
SpecFlow.NUnit (3.4.14)
Nunit.ConsoleRunner (3.11.1)
Azure Pipeline (using VSTest)
The Azure Pipeline has a built in feature to retry failed tests. When a test fails the test name is created and passed to VSTest. When a SpecFlow Scenario Outline is used - the test name is build from the Scenario with the various data from the Example table in the Scenario Outline - to build a unique test name.
VSTest will throw an exception at this point (Unhandled Exception: System.ArgumentException: Illegal characters in path) - that will cause the retry process to fail.
Any solutions to creating a better formed test name ???
Below are some log files samples:
Any help is appreciated
Thanks - Chris ([email protected])
Steps to Reproduce
We are running in the Azure Pipeline. Happy to give you more information - or do a call if you wish.
Repro Project
I can probably arrange this if it would be helpful
The text was updated successfully, but these errors were encountered: