-
Notifications
You must be signed in to change notification settings - Fork 105
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
Test in all target environments using the correct version of the NUnit VSTest adapter #450
Conversation
@OsirisTerje I have permission to merge without review. I'm so used to clicking it as soon as it turns green that I'm afraid I may cause an accident. |
@jnm2 @OsirisTerje Just a thought... Being allowed to do something by a software system is not equivalent to "what you are supposed to do." That's one reason I drag my feet as far as automating various "supposed to do" things like this, like standards, etc. I believe the best teams are grown when people actually talk to one another rather than relying on software permissions. On a more practical note... only owners (me and Rob) and admins (set by each project's lead) are allowed to override the review requirement. It's possible that @OsirisTerje has not set up the review requirement for that repository. Recollect that we did agree that such things were up to each project lead. FWIW if I were the project lead, I would not set up the GitHub review requirement because it leads to the bad situation that @jnm2 describes - people get used to the system telling them what it's OK to do. See paragraph 1. Of course, that's just me. 😸 |
I'll continue to try to pay attention. Staying up till 1 am every night is not the best way to fight jetlag after skipping a night of sleep, I found out today. 😝 |
Hey, I just realized that this isn't ready to merge yet. The second commit starts skipping all net45 tests because on net45 the engine loads the tests in a different appdomain and it can't find I can't think of any way to make this work other than a .runsettings file containing Running the tests in the same appdomain as the engine seems to cause some remoting URL conflicts. I'll try to see what that's about. (To be clear, these measures are not necessary in general. Only for the test project NUnit.TestAdapter.Tests which references TP.ObjectModel.dll—we do need it to use the right one.) |
Hey, WIPbot showed up! How cool is that! 😄 |
Starting to look like we'll need a new release of the engine which allows you to override the default URL of the test agency before starting it without having to know about and set up every other service on your own. |
7694f91
to
92d52f6
Compare
92d52f6
to
bf648f5
Compare
engine.Services.Add(new DefaultTestRunnerFactory()); | ||
engine.Services.Add(new TestAgency("TestAgency for " + TestContext.CurrentContext.Test.Name, 0)); | ||
engine.Services.Add(new ResultService()); | ||
engine.Services.Add(new TestFilterService()); |
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.
The engine needs to provide some way to override a service before starting all the services without forcing you to maintain an almost identical list like this.
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.
I added something like this in a recent test. I think it needed InternalsVisibleTo
...
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.
Oh. Looks like it never got committed. 😞 nunit/nunit-console#320 (comment)
Got it working! 🎉 Ready for review! |
I locally rebased https://github.com/nunit/nunit3-vs-adapter/compare/jnm2/replace_cecil on a test merge of this PR and it's looking very positive! This PR was the hard part! 😊 Only thing left is some of the navigation tests like the async ones. I can look at what we had before #186. |
bf648f5
to
c802ff7
Compare
I discovered that there is a difference between the IDE's vstest and dotnet vstest when it comes to .NET Framework tests, so we need to be testing:
This is done in the last commit. |
NuGet timed out on VSTS. I queued a new build which succeeded but didn't update the status of the commit. |
I'm not absolutely sure that we need to run all tests against |
Hooray, I have nothing left to do! The Mono.Cecil removal PR is waiting on this one at #454. |
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.
Ok
Blocking my work on #296. This was complex enough to peel away into a targeted PR.
From my findings in https://github.com/nunit/nunit3-vs-adapter/compare/jnm2/replace_cecil:
Any code that uses DiaSession must run in an environment that has already loaded a version of Microsoft.VisualStudio.TestPlatform.ObjectModel.dll which is newer than the one we must compile against for net35. The one we compile against tries to load msdia110typelib_clr0200.dll from the VS2012 installation. While we must compile against it, we must not distribute it or run our tests against it.
We got away with running tests against it in the past, but so many of our tests require navigation data (even unrelated tests) that we will not be able to continue with this misconfiguration once we start using TP.ObjectModel.dll's DiaSession constructor. This includes both direct referencing or pure reflection.
Self-executing adapter tests are out of the question unless we write a host that locates VSTest from
.dotnet
orvswhere
and loads the correctMicrosoft.VisualStudio.TestPlatform.ObjectModel.dll
, or unless we barely run any tests at all. The point of our VSTest adapter has nothing to do with self-executing tests. Running those few tests that can pass is merely duplicating the testing already done by the tests which we do run using VSTest. Self-executing tests are complexity with no benefit.Since we publish a VSTest adapter, what we do care about is testing it in every environment that might use it. Ones I know about currently include:
If VSTest supports frameworks other than .NET Framework and .NET Core such as UWP (or when VSTest finally supports .NET Standard test assemblies), we should look at expanding that someday.
Therefore, I removed our
TestAdapter
andTestAdapterNetCore
self-executing test targets and expanded ourTestAdapterUsingVSTest
into four targets:VSTest-net45
VSTest-netcoreapp1.0
DotnetTest-net45
DotnetTest-netcoreapp1.0
As soon as the self-executing .NET Core tests were gone, we no longer needed the publish step. I was thus able to undo that part of 3bf25c8. Test failures forced me to undo other parts. With the new test targets, the folder nesting level for the assemblies built for .NET Core now matches .NET Framework.
Does this change seem sound?