-
Notifications
You must be signed in to change notification settings - Fork 323
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
Run NetFramework tests inside vstest.console.exe process #1009
Conversation
Please see the matrix below to see the benefit of using Performance matrix
|
{ | ||
EqtTrace.Error("InProcessProxyexecutionManager.StartTestRun: Failed to start test run: {0}", exception); | ||
|
||
// Send a discovery complete to caller. |
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.
nit: change comment to test execution complete
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.
Fixed in next commit.
@@ -59,14 +63,19 @@ public IProxyDiscoveryManager GetDiscoveryManager(ITestRuntimeProvider testHostM | |||
{ | |||
var parallelLevel = this.VerifyParallelSettingAndCalculateParallelLevel(discoveryCriteria.Sources.Count(), discoveryCriteria.RunSettings); |
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 can be moved below
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.
Fixed in next commit.
} | ||
|
||
var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(runsettings); | ||
|
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.
Add a comment specifying when will we enable InProc run
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.
Fixed
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.TesthostProtocol; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; | ||
|
||
class InProcessProxyDiscoveryManager : IProxyDiscoveryManager |
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.
public or internal class?
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.
internal
EqtTrace.Error("InProcessProxyDiscoveryManager.DiscoverTests: Failed to discover tests: {0}", exception); | ||
|
||
// Send a discovery complete to caller. | ||
eventHandler.HandleLogMessage(TestMessageLevel.Error, exception.Message); |
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.
Log exception stacktrace also on failure scenario.
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.
fixed
} | ||
} | ||
|
||
public int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler eventHandler) |
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.
Nit: doc.
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.
fixed
if (runConfiguration.InProcess && | ||
!runConfiguration.DisableAppDomain && | ||
!runConfiguration.DesignMode && | ||
!(runConfiguration.TargetFrameworkVersion.Name.IndexOf("netstandard", StringComparison.OrdinalIgnoreCase) >= 0 |
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.
Use Name.StartsWith()
?
What scenario the netstandard is being used as TargetFramework?
If we target netstandard2.0, can enable this scenarion for .net core?
!(runConfiguration.TargetFrameworkVersion.Name.IndexOf("netstandard", StringComparison.OrdinalIgnoreCase) >= 0 | ||
|| runConfiguration.TargetFrameworkVersion.Name.IndexOf("netcoreapp", StringComparison.OrdinalIgnoreCase) >= 0)) | ||
{ | ||
return true ; |
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.
Log eqttrace message on successful/unsuccessful using of inproc. Give warning on using inproc option for not supported target frameworks.
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.
Fixed!
@@ -376,6 +399,15 @@ public bool DisableAppDomainSet | |||
} | |||
|
|||
/// <summary> | |||
/// Gets a value indicating whether InProcess is set. | |||
/// </summary> | |||
public bool InProcessSet |
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.
Where is this used?
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.
Removed
/// <param name="eventHandler">EventHandler for handling discovery events from Engine</param> | ||
public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler eventHandler) | ||
{ | ||
var discoveryManager = this.testHostManagerFactory.GetDiscoveryManager(); |
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.
Why calling GetDiscoveryManager()
in every method, Can be a member variable?
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.
and we can call Initilize() instead of doing check below.
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.
Fixed
public void InitializeShouldCallDiscoveryManagerInitializeWithEmptyIEnumerable() | ||
{ | ||
this.inProcessProxyDiscoveryManager.Initialize(); | ||
this.mockDiscoveryManager.Verify(o => o.Initialize(Enumerable.Empty<string>()), Times.Once); |
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.
Add assert failure message for all asserts.
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.
Fix in next commit.
// Start using these additional extensions | ||
TestPluginCache.Instance.DefaultExtensionPaths = pathToAdditionalExtensions; | ||
if (pathToAdditionalExtensions != null && pathToAdditionalExtensions.Count() > 0) | ||
{ |
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.
Can we use pathToAdditionalExtensions.Any() instead of pathToAdditionalExtensions.Count() > 0?
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.
Yes we can use
/// </summary> | ||
public void Abort() | ||
{ | ||
Task.Run(() => this.testHostManagerFactory.GetDiscoveryManager().Abort()); |
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.
Do we require any null check for this.testHostManagerFactory?
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.
No, we don't require. If its null, process should catch exception
2) Enable InIsolation argument to disable default in process. 3) Address PR comment
internal class InProcessProxyDiscoveryManager : IProxyDiscoveryManager | ||
{ | ||
private ITestHostManagerFactory testHostManagerFactory; | ||
IDiscoveryManager discoveryManager; |
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.
Explicit annotation for types.
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.
Fixed in next commit.
|
||
// Send a discovery complete to caller. | ||
eventHandler.HandleLogMessage(TestMessageLevel.Error, exception.ToString()); | ||
eventHandler.HandleDiscoveryComplete(-1, new List<TestCase>(), true); |
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.
Enumerable.Empty<TestCase>
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.
Fixed
var executionContext = new TestExecutionContext( | ||
testRunCriteria.FrequencyOfRunStatsChangeEvent, | ||
testRunCriteria.RunStatsChangeEventTimeout, | ||
inIsolation: false, |
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.
How is this used in TPv1? Are we missing scenario?
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 info get passed to adapter through RunContext
|
||
if (testRunCriteria.HasSpecificSources) | ||
{ | ||
// [TODO]: we need to revisit to second-last argument if we will enable datacollector. |
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.
nit: remove todo
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.
Fixed
hasTestRun: true, | ||
isDebug: (testRunCriteria.TestHostLauncher != null && testRunCriteria.TestHostLauncher.IsDebug), | ||
testCaseFilter: testRunCriteria.TestCaseFilter); | ||
|
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.
We should ask TestRuntimeProvider for extensions.
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.
Yes, we should.
Run test within vstest.console.exe process for project targeting
NetFramework
if running from commandline.This will be the default behavior. To opt out default behavior user has to explicitly pass '/InIsolation' argument.