SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.24k stars 754 forks source link

Azure Devops - Test filter criteria does not work when we use "!=" to exclude certain TestCategory #2060

Closed hawisback closed 3 years ago

hawisback commented 4 years ago

Test Filter Criteria does not exclude tests when run in pipeline.

SpecFlow Version:

Used Test Runner

Version number:

Project Format of the SpecFlow project

.feature.cs files are generated using

Visual Studio Version

Enable SpecFlowSingleFileGenerator Custom Tool option in Visual Studio extension settings

Are the latest Visual Studio updates installed?

.NET Framework:

Test Execution Method:

<SpecFlow> Section in app.config or content of specflow.json

Adding just the configuration section:
  <configSections>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
  </configSections>

Repro Project

Cannot share the project as it is hosted on secured server. ### Issue Description

My test build runs perfectly fine and there are no issues with that. When running in pipeline, we are now having to exclude some tests due to some dependencies and we got this "Test filter criteria" option in Task "Visual Studio Test". The Test filter criteria works fine when we use "=" IS EQUAL and executes the tests with traits that satisfy the condition. While the same fails to exclude tests when using "!=" for NOT condition.

Examples: Works fine: “TestCategory=automated” – executes the scenarios marked with @automated

Does not work fine: Expected: “TestCategory!=Manual” – executes the scenarios that are not marked with @Manual Actual: “TestCategory!=Manual” – executes all the scenarios including the ones that are marked with @Manual

Steps to Reproduce

Create a build. Set the Test filter criteria in Visual Studio Test with below filter criteria. TestCategory!=Manual Expected: Executes the scenarios that are not marked with @Manual

epresi commented 4 years ago

I created a small repro project, but sadly I was not able to reproduce this with the latest SpecFlow and SpecFlow+ Runner. It would be helpful, if you could send us a small repro project.

We could then try the test category filters locally, e.g.: vstest.console.exe "C:\Temp\TestProject\bin\Debug\Tests.dll" /TestCaseFilter:"TestCategory!=Manual"

Also, can you please share your package versions with us? Do you have an srprofile for the Runner? If yes, it could be helpful if you share that too with us.

SabotageAndi commented 3 years ago

Closed because of inactivity

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.