-
Notifications
You must be signed in to change notification settings - Fork 288
Added an option to deploy all files in the test source location #391
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
9 commits
Select commit
Hold shift + click to select a range
5aa11a3
Added an option to deploy the test source dependencies and satellite …
cltshivash b9f6f65
Removed couple of redundant tests
cltshivash 3321a73
Merge branch 'master' into master
cltshivash 5e1a563
Merge branch 'master' into master
cltshivash 9a6f307
Merge branch 'master' into master
cltshivash a43a940
Merge branch 'master' into master
cltshivash 4bec349
Merge branch 'master' into master
cltshivash 10f5b68
Minor review comment updated.
8425a55
Removed and unused file
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,81 +1,17 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Globalization; | ||
| using System.IO; | ||
| using System.Xml; | ||
|
|
||
| using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
| using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; | ||
|
|
||
| using ISettingsProvider = Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.ISettingsProvider; | ||
|
|
||
| #pragma warning disable SA1649 // File name must match first type name | ||
|
|
||
| /// <summary> | ||
| /// Class to read settings from the runsettings xml for the desktop. | ||
| /// </summary> | ||
| public class MSTestSettingsProvider : ISettingsProvider | ||
| #pragma warning restore SA1649 // File name must match first type name | ||
| { | ||
| /// <summary> | ||
| /// Member variable for Adapter settings | ||
| /// </summary> | ||
| private static MSTestAdapterSettings settings; | ||
|
|
||
| /// <summary> | ||
| /// Gets settings provided to the adapter. | ||
| /// </summary> | ||
| public static MSTestAdapterSettings Settings | ||
| { | ||
| get | ||
| { | ||
| if (settings == null) | ||
| { | ||
| settings = new MSTestAdapterSettings(); | ||
| } | ||
|
|
||
| return settings; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Load the settings from the reader. | ||
| /// </summary> | ||
| /// <param name="reader">Reader to load the settings from.</param> | ||
| public void Load(XmlReader reader) | ||
| { | ||
| ValidateArg.NotNull<XmlReader>(reader, "reader"); | ||
|
|
||
| settings = MSTestAdapterSettings.ToSettings(reader); | ||
| } | ||
|
|
||
| public IDictionary<string, object> GetProperties(string source) | ||
| { | ||
| return TestDeployment.GetDeploymentInformation(source); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Reset the settings to its default. | ||
| /// Used for testing purposes. | ||
| /// </summary> | ||
| internal static void Reset() | ||
| { | ||
| settings = null; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Adapter Settings for the run | ||
| /// </summary> | ||
| #pragma warning disable SA1402 | ||
| public class MSTestAdapterSettings | ||
| #pragma warning restore SA1402 | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="MSTestAdapterSettings"/> class. | ||
|
|
@@ -84,6 +20,7 @@ public MSTestAdapterSettings() | |
| { | ||
| this.DeleteDeploymentDirectoryAfterTestRunIsComplete = true; | ||
| this.DeploymentEnabled = true; | ||
| this.DeployTestSourceDependencies = true; | ||
| this.SearchDirectories = new List<RecursiveDirectoryPath>(); | ||
| } | ||
|
|
||
|
|
@@ -97,6 +34,11 @@ public MSTestAdapterSettings() | |
| /// </summary> | ||
| public bool DeleteDeploymentDirectoryAfterTestRunIsComplete { get; private set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets a value indicating whether the test source references are to deployed | ||
cltshivash marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| public bool DeployTestSourceDependencies { get; private set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets list of paths recursive or non recursive paths. | ||
| /// </summary> | ||
|
|
@@ -107,7 +49,6 @@ public MSTestAdapterSettings() | |
| /// </summary> | ||
| /// <param name="reader">Reader to load the settings from.</param> | ||
| /// <returns>An instance of the <see cref="MSTestAdapterSettings"/> class</returns> | ||
| [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "Reviewed. Suppression is OK here.")] | ||
| public static MSTestAdapterSettings ToSettings(XmlReader reader) | ||
| { | ||
| ValidateArg.NotNull<XmlReader>(reader, "reader"); | ||
|
|
@@ -116,6 +57,7 @@ public static MSTestAdapterSettings ToSettings(XmlReader reader) | |
| // | ||
| // <MSTestV2> | ||
| // <DeploymentEnabled>true</DeploymentEnabled> | ||
| // <DeployTestSourceDependencies>true</DeployTestSourceDependencies> | ||
|
Member
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. Nice 👍 |
||
| // <DeleteDeploymentDirectoryAfterTestRunIsComplete>true</DeleteDeploymentDirectoryAfterTestRunIsComplete> | ||
| // <AssemblyResolution> | ||
| // <Directory path= "% HOMEDRIVE %\direvtory "includeSubDirectories = "true" /> | ||
|
|
@@ -151,6 +93,16 @@ public static MSTestAdapterSettings ToSettings(XmlReader reader) | |
| break; | ||
| } | ||
|
|
||
| case "DEPLOYTESTSOURCEDEPENDENCIES": | ||
| { | ||
| if (bool.TryParse(reader.ReadInnerXml(), out result)) | ||
| { | ||
| settings.DeployTestSourceDependencies = result; | ||
| } | ||
|
|
||
| break; | ||
| } | ||
|
|
||
| case "DELETEDEPLOYMENTDIRECTORYAFTERTESTRUNISCOMPLETE": | ||
| { | ||
| if (bool.TryParse(reader.ReadInnerXml(), out result)) | ||
|
|
||
61 changes: 61 additions & 0 deletions
61
src/Adapter/PlatformServices.Desktop/Services/MSTestSettingsProvider.cs
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 |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices | ||
| { | ||
| using System.Collections.Generic; | ||
| using System.Xml; | ||
| using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
|
|
||
| using ISettingsProvider = Interface.ISettingsProvider; | ||
|
|
||
| /// <summary> | ||
| /// Class to read settings from the runsettings xml for the desktop. | ||
| /// </summary> | ||
| public class MSTestSettingsProvider : ISettingsProvider | ||
| { | ||
| /// <summary> | ||
| /// Member variable for Adapter settings | ||
| /// </summary> | ||
| private static MSTestAdapterSettings settings; | ||
|
|
||
| /// <summary> | ||
| /// Gets settings provided to the adapter. | ||
| /// </summary> | ||
| public static MSTestAdapterSettings Settings | ||
| { | ||
| get | ||
| { | ||
| if (settings == null) | ||
| { | ||
| settings = new MSTestAdapterSettings(); | ||
| } | ||
|
|
||
| return settings; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Reset the settings to its default. | ||
| /// </summary> | ||
| public static void Reset() | ||
| { | ||
| settings = null; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Load the settings from the reader. | ||
| /// </summary> | ||
| /// <param name="reader">Reader to load the settings from.</param> | ||
| public void Load(XmlReader reader) | ||
| { | ||
| ValidateArg.NotNull(reader, "reader"); | ||
| settings = MSTestAdapterSettings.ToSettings(reader); | ||
| } | ||
|
|
||
| public IDictionary<string, object> GetProperties(string source) | ||
| { | ||
| return TestDeployment.GetDeploymentInformation(source); | ||
| } | ||
| } | ||
| } |
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 |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Uti | |
| using System.Collections.Generic; | ||
| using System.Diagnostics; | ||
| using System.Globalization; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Reflection; | ||
|
|
||
|
|
@@ -91,14 +92,14 @@ internal bool IsValidDeploymentItem(string sourcePath, string relativeOutputDire | |
| return false; | ||
| } | ||
|
|
||
| if (sourcePath.IndexOfAny(System.IO.Path.GetInvalidPathChars()) != -1 || | ||
| relativeOutputDirectory.IndexOfAny(System.IO.Path.GetInvalidPathChars()) != -1) | ||
| if (sourcePath.IndexOfAny(Path.GetInvalidPathChars()) != -1 || | ||
|
Member
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. 👍 |
||
| relativeOutputDirectory.IndexOfAny(Path.GetInvalidPathChars()) != -1) | ||
| { | ||
| warning = string.Format(CultureInfo.CurrentCulture, Resource.DeploymentItemContainsInvalidCharacters, sourcePath, relativeOutputDirectory); | ||
| return false; | ||
| } | ||
|
|
||
| if (System.IO.Path.IsPathRooted(relativeOutputDirectory)) | ||
| if (Path.IsPathRooted(relativeOutputDirectory)) | ||
| { | ||
| warning = string.Format(CultureInfo.CurrentCulture, Resource.DeploymentItemOutputDirectoryMustBeRelative, relativeOutputDirectory); | ||
| return false; | ||
|
|
@@ -123,18 +124,15 @@ internal bool HasDeploymentItems(TestCase testCase) | |
| internal IList<DeploymentItem> GetDeploymentItems(IEnumerable<TestCase> tests) | ||
| { | ||
| List<DeploymentItem> allDeploymentItems = new List<DeploymentItem>(); | ||
|
|
||
| foreach (var test in tests) | ||
| { | ||
| KeyValuePair<string, string>[] items = this.GetDeploymentItems(test); | ||
|
|
||
| if (items == null || items.Length == 0) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| IList<DeploymentItem> deploymentItemsToBeAdded = this.FromKeyValuePairs(items); | ||
|
|
||
| foreach (var deploymentItemToBeAdded in deploymentItemsToBeAdded) | ||
| { | ||
| this.AddDeploymentItem(allDeploymentItems, deploymentItemToBeAdded); | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.