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

Implemented functionality to return non-zero value when no tests available. #2610

Merged
merged 24 commits into from
Nov 3, 2020

Conversation

Sanan07
Copy link
Contributor

@Sanan07 Sanan07 commented Oct 30, 2020

Description

Introduce new RunConfiguration parameter called TreatNoTestsAsError, which can have values true and false . true means that we want to return non-zero value when no tests are available.

Parameter can be set through runsettings file <RunConfiguration><TreatNoTestsAsError>true</TreatNoTestsAsError> </RunConfiguration> as well as through command line : -- RunConfiguration.TreatNoTestsAsError=true . Command line argument has higher priority, so it will override the value in .runsettings file, if the latter exists.

This works the same for dotnet test command.

Fix #2590
Fix #2262
Fix #2247

Update: renamed FailWhenNoTestsFound to TreatNoTestsAsError as it was shipped.

@nohwnd
Copy link
Member

nohwnd commented Nov 2, 2020

Will the related issues be fixed by this? Is there a reason to not mark them as Fix in the description?

Is there a reason the name from the proposal "TreatNoTestsAsError" is not used? Or is it simply personal preference?

@Sanan07
Copy link
Contributor Author

Sanan07 commented Nov 2, 2020

All mentioned issues are the same, only one of them related to dotnet test part of the feature. When this change merged, I will mark all of them as fixed. I used FailWhenNoTestsFound which is personal preference and from my perspective is more understandable for end use.

@nohwnd
Copy link
Member

nohwnd commented Nov 2, 2020

Updated the description to automatically close the linked issues, when you merge. It's easier to navigate back to the change that way, and it avoids keeping up with related issues manually.

@Sanan07 Sanan07 self-assigned this Nov 2, 2020
Copy link
Contributor

@Haplois Haplois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@Haplois Haplois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nitpick, but I think we should use "Discovered" instead of found, and use singular "Test" instead of "Tests".

@Sanan07
Copy link
Contributor Author

Sanan07 commented Nov 3, 2020

I changed the name to TreatNoTestsAsError.

@Sanan07 Sanan07 merged commit fda96e0 into master Nov 3, 2020
@Sanan07 Sanan07 deleted the dev/sayuzbas/set-zero branch November 3, 2020 11:46
@willdean
Copy link

For the benefit of people (like me) who need this feature but don't find it well documented, the magic you need to add to the command line is -- RunConfiguration.TreatNoTestsAsError=true

Note the space after the -- and that the parameter value changed during this issue, so comment at the top is outdated.

@ColbyODonnell
Copy link

ColbyODonnell commented May 1, 2023

The documentation here (https://learn.microsoft.com/en-us/visualstudio/test/vstest-console-options?view=vs-2019) incorrectly lists FailWhenNoTestsFound which does not work. This pull request also makes it seem like FailWhenNoTestsFound is the intended value, but it does not work. I spent 2 hours struggling with this. Whatever name is picked, please follow up with updated documentation.

@nohwnd
Copy link
Member

nohwnd commented May 25, 2023

That option was not shipped, updated the docs. MicrosoftDocs/visualstudio-docs#9266

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants