Skip to content
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

Automatically include TechTalk.SpecFlow.MSTest.SpecFlowPlugin.dll as a deployment item for MSTest V2 #2301

Merged
merged 3 commits into from Feb 12, 2021

Conversation

icnocop
Copy link
Contributor

@icnocop icnocop commented Feb 9, 2021

Fixes #2076

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • Performance improvement
  • Refactoring (so no functional change)
  • Other (docs, build config, etc)

Checklist:

  • I've added tests for my code. (most of the time mandatory)
  • I have added an entry to the changelog. (mandatory)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@SabotageAndi
Copy link
Contributor

This will always put a [DeploymentItem] attribute on every feature class. Which has a side effect for users, that don't have deployment items yet. When using DeploymentItems, the output path is different as without any. It will switch to the TestResults folder from the output directory.

Could you only add the attribute, if there is a deployment item somewhere in the feature file set?

@icnocop
Copy link
Contributor Author

icnocop commented Feb 9, 2021

Done.

Thank you.

@SabotageAndi
Copy link
Contributor

Cool, thanks for the change.
One thing I am not sure atm. Can't be the @deploymentitem tag be also on a scenario? In that case, no attribute is added to the class.

@icnocop
Copy link
Contributor Author

icnocop commented Feb 10, 2021

Thank you.

I also considered that case and so I tested adding @MsTest:DeploymentItem:test.txt to a Scenario, but the DeploymentItemAttribute was not added to either the test class or the test method.

According to https://docs.specflow.org/projects/specflow/en/latest/Integrations/MsTest.html:

Tags for TestClass Attributes
The MsTest Generator can generate test class attributes from tags specified on a feature.

@SabotageAndi
Copy link
Contributor

@icnocop
Copy link
Contributor Author

icnocop commented Feb 10, 2021

It seems that code was added as part of #1671 but no tests were created specifically for it.

@icnocop
Copy link
Contributor Author

icnocop commented Feb 10, 2021

I'm wondering if any code coverage tools could have picked up the untested code. 🤷🏼‍♂️

@icnocop
Copy link
Contributor Author

icnocop commented Feb 10, 2021

Also see #803 (comment).

The original implementation only supported the tag on the feature level.

@SabotageAndi
Copy link
Contributor

I added a PR to add the missing test for this: #2302
It's green, so it is working.
No idea, why we didn't add the scenario back then.

@SabotageAndi
Copy link
Contributor

Ok, I had a deeper look at it. DeploymentItems on Scenario level are still only half-implemented. They are missing in SetTestMethodCategories.

I would merge this PR now @icnocop and create an issue for fixing the implementation. Ok?

@SabotageAndi SabotageAndi merged commit b5560a2 into SpecFlowOSS:master Feb 12, 2021
@SabotageAndi
Copy link
Contributor

@icnocop I merged it now, because we are before a release and want to include this in it, as it changes the code-behind file generation.

@icnocop
Copy link
Contributor Author

icnocop commented Feb 12, 2021

Thank you.

@SabotageAndi
Copy link
Contributor

Thanks for your contribution to SpecFlow @icnocop!
Please submit it to our SpecFlow Community Heroes program at https://specflow.org/community/community-hero-program/

Code-Grump pushed a commit to Code-Grump/SpecFlow that referenced this pull request Mar 29, 2023
…a deployment item for MSTest V2 (SpecFlowOSS#2301)

Fixes SpecFlowOSS#2076

Co-authored-by: Andreas Willich <SabotageAndi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Features with deployment items don't find a testruntimeprovider
2 participants