-
Notifications
You must be signed in to change notification settings - Fork 346
fixed reading test adapter paths from runsettings #455
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
439ccd9
fixed reading test adapter paths from runsettings
rahulpaw bd36aa4
addressed comments
rahulpaw fd3efec
moved the pattern to a constant
rahulpaw 15a96e2
Merge branch 'master' into testadapterrunsettingsfix
rahulpaw df96d77
addressed failing tests by passing the regex pattern in filehelper
rahulpaw 5978a3e
Merge branch 'master' into testadapterrunsettingsfix
rahulpaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,15 @@ | |
| namespace Microsoft.VisualStudio.TestPlatform.Client | ||
| { | ||
| using System; | ||
| using System.IO; | ||
| using System.Collections.Generic; | ||
|
|
||
| using Microsoft.VisualStudio.TestPlatform.Client.Discovery; | ||
| using Microsoft.VisualStudio.TestPlatform.Client.Execution; | ||
| using Microsoft.VisualStudio.TestPlatform.Common; | ||
| using Microsoft.VisualStudio.TestPlatform.Common.Utilities; | ||
| using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; | ||
| using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
| using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; | ||
| using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; | ||
| using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; | ||
|
|
@@ -54,6 +58,8 @@ public IDiscoveryRequest CreateDiscoveryRequest(DiscoveryCriteria discoveryCrite | |
| throw new ArgumentNullException("discoveryCriteria"); | ||
| } | ||
|
|
||
| UpdateTestAdapterPaths(discoveryCriteria.RunSettings); | ||
|
|
||
| var runconfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(discoveryCriteria.RunSettings); | ||
| var testHostManager = this.TestEngine.GetDefaultTestHostManager(runconfiguration); | ||
|
|
||
|
|
@@ -76,6 +82,8 @@ public ITestRunRequest CreateTestRunRequest(TestRunCriteria testRunCriteria) | |
| throw new ArgumentNullException("testRunCriteria"); | ||
| } | ||
|
|
||
| UpdateTestAdapterPaths(testRunCriteria.TestRunSettings); | ||
|
|
||
| var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(testRunCriteria.TestRunSettings); | ||
| var testHostManager = this.TestEngine.GetDefaultTestHostManager(runConfiguration); | ||
|
|
||
|
|
@@ -121,5 +129,33 @@ public void UpdateExtensions(IEnumerable<string> pathToAdditionalExtensions, boo | |
| this.TestEngine.GetExtensionManager() | ||
| .UseAdditionalExtensions(pathToAdditionalExtensions, loadOnlyWellKnownExtensions); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Update the test adapter paths provided through run settings to be used by the test service | ||
| /// </summary> | ||
| private void UpdateTestAdapterPaths(string runSettings) | ||
| { | ||
| IEnumerable<string> customTestAdaptersPaths = RunSettingsUtilities.GetTestAdaptersPaths(runSettings); | ||
|
|
||
| if (customTestAdaptersPaths != null) | ||
| { | ||
| foreach (string customTestAdaptersPath in customTestAdaptersPaths) | ||
| { | ||
| var adapterPath = Path.GetFullPath(Environment.ExpandEnvironmentVariables(customTestAdaptersPath)); | ||
| if (!Directory.Exists(adapterPath)) | ||
| { | ||
| EqtTrace.Warning(string.Format("AdapterPath Not Found:", adapterPath)); | ||
| continue; | ||
| } | ||
| List<string> adapterFiles = new List<string>( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic is duplicated across many files. Should we consolidate? |
||
| Directory.EnumerateFiles(adapterPath,TestPlatformConstants.TestAdapterPattern , SearchOption.AllDirectories) | ||
| ); | ||
| if (adapterFiles.Count > 0) | ||
| { | ||
| this.UpdateExtensions(adapterFiles, false); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 caused issue in Tpv1, when in VS IDE scenario data collectors were enabled, & runsettings were used to provide adapter path, it resulted in DataCollection(fakes, CodeCoverage) not working.
The workaround we used was to not update them here, but instead like we process TestAdapterPath in CLI, similarly process it, & apply it on ITestPlatform when provided via 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.
I would like to take a deeper look at the datacollector scenarios. but right now TPv2 does not support DataCollectors.