-
Notifications
You must be signed in to change notification settings - Fork 416
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
Support to run MSTest based tests. #856
Conversation
Tagging @DustinCampbell for a review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Still going to wait for dustin if he has any comments, but looks pretty straight forward.
Should unit tests/test projects be added as part of this @david-driscoll? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests should be added for this change. It should be pretty easy since there are already tests for xUnit and NUnit to base them on.
protected override bool IsTestAttributeName(string typeName) | ||
{ | ||
return typeName == "Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute" | ||
|| typeName == "Microsoft.VisualStudio.TestTools.UnitTesting.DataTestMethodAttribute"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DataTestMethodAttribute
is not needed here, because it inherits from TestMethodAttribute
.
The code in OmniSharp checks the whole inheritance tree for the attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is similar to the xunit code in OmniSharp not checking for TheoryAttribute
-> because it inherits from FactAttribute
To add tests:
|
Thanks @DustinCampbell . Will update the PR soon. Would we need one for the legacy scenarios as well? I see a LegacyXunitTestProject & LegacyNunitTestProject . |
There's no need to add a legacy test project. Those are for older project.json. Those tests are just to ensure we don't break that older support. We never supported MSTest for project.json .NET Core projects (was it even possible?) |
MSTest tests did work with project.json. There was a dotnet-test-mstest that drove those scenarios which leads me to guess that there are more changes required to enable that support in. |
If that's the case, this change will likely make MS Test work for project.json projects. It might be worth adding some legacy tests as well. There are |
The legacy tests however are not running as expected and hence are commented for now. In the process of figuring out why this bombs.
@dotnet-bot test this please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good!
@AbhitejJohn: Note that this repo doesn't use the @dotnet-bot build/test infrastructure. |
@DustinCampbell : Oh ok. It looks like we have a problem with the Legacy workflow though - When we run the test we pass in a commandline similar to
This step however seems to be missing in the vs code implementation which expects the adapter to pick up the tests from the commandline arguments itself. That seems to be confusing dotnet-test-mstest which defaults to running all the tests in the source instead. Should we change this workflow to reflect the above instead - either remove |
@AbhitejJohn: Yeah, I don't think the project.json support was ever truly completed. It was gotten to a point of "good enough" and somewhat abandoned when the developer who worked on it moved on. While adding the new vstest support, I tried to just preserve the legacy support since there will be fewer and fewer people using it. I'd recommend removing |
…sn't required since we pass in the test list upfront.
…arp-roslyn into mstestsupport
@DustinCampbell : Fixed in the latest update. |
Thanks @AbhitejJohn! Looks good! Do you have any other changes? If not, I'll merge as soon as CI completes. |
@DustinCampbell : No, I'm done. |
Accompanying PR : dotnet/vscode-csharp#1478