-
Notifications
You must be signed in to change notification settings - Fork 5.1k
chore(playwrighttesting): populate NumberOfTestWorkers from runsettings and refactor PlaywrightReporter #47066
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
kashish2508
merged 2 commits into
Azure:main
from
Sid200026:users/ssingharoy/refactor-playwright-reporter
Nov 12, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
26 changes: 26 additions & 0 deletions
26
....Developer.MicrosoftPlaywrightTesting.TestLogger/src/Implementation/EnvironmentHandler.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,26 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using Azure.Developer.MicrosoftPlaywrightTesting.TestLogger.Interface; | ||
|
|
||
| namespace Azure.Developer.MicrosoftPlaywrightTesting.TestLogger.Implementation | ||
| { | ||
| internal class EnvironmentHandler : IEnvironment | ||
| { | ||
| public void Exit(int exitCode) | ||
| { | ||
| Environment.Exit(exitCode); | ||
| } | ||
|
|
||
| public string GetEnvironmentVariable(string variable) | ||
| { | ||
| return Environment.GetEnvironmentVariable(variable); | ||
| } | ||
|
|
||
| public void SetEnvironmentVariable(string variable, string value) | ||
| { | ||
| Environment.SetEnvironmentVariable(variable, value); | ||
| } | ||
| } | ||
| } |
49 changes: 49 additions & 0 deletions
49
...zure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Implementation/XmlRunSettings.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,49 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Xml; | ||
| using Azure.Developer.MicrosoftPlaywrightTesting.TestLogger.Interface; | ||
| using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; | ||
|
|
||
| namespace Azure.Developer.MicrosoftPlaywrightTesting.TestLogger.Implementation | ||
| { | ||
| internal class XmlRunSettings : IXmlRunSettings | ||
| { | ||
| private static readonly string NUnitNodeName = "NUnit"; | ||
| public Dictionary<string, object> GetTestRunParameters(string? settingsXml) | ||
| { | ||
| return XmlRunSettingsUtilities.GetTestRunParameters(settingsXml); | ||
| } | ||
|
|
||
| public Dictionary<string, object> GetNUnitParameters(string? settingsXml) | ||
| { | ||
| try | ||
| { | ||
| var parameters = new Dictionary<string, object>(); | ||
| XmlDocument xmlDocument = ParseXmlSettings(settingsXml); | ||
| XmlNodeList nUnitNodes = xmlDocument.GetElementsByTagName(NUnitNodeName); | ||
| foreach (XmlNode nUnitNode in nUnitNodes) | ||
| { | ||
| foreach (XmlNode childNode in nUnitNode.ChildNodes) | ||
| { | ||
| parameters.Add(childNode.Name, childNode.InnerText); | ||
| } | ||
| } | ||
| return parameters; | ||
| } | ||
| catch (Exception) | ||
| { | ||
| return new Dictionary<string, object>(); | ||
| } | ||
| } | ||
|
|
||
| private static XmlDocument ParseXmlSettings(string? settingsXml) | ||
| { | ||
| XmlDocument xmlDocument = new(); | ||
| xmlDocument.LoadXml(settingsXml); | ||
| return xmlDocument; | ||
| } | ||
| } | ||
| } |
12 changes: 12 additions & 0 deletions
12
...sting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Interface/IEnvironment.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,12 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Azure.Developer.MicrosoftPlaywrightTesting.TestLogger.Interface | ||
| { | ||
| internal interface IEnvironment | ||
| { | ||
| void Exit(int exitCode); | ||
| string GetEnvironmentVariable(string variable); | ||
| void SetEnvironmentVariable(string variable, string value); | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
...ng/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Interface/IXmlRunSettings.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,13 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Collections.Generic; | ||
|
|
||
| namespace Azure.Developer.MicrosoftPlaywrightTesting.TestLogger.Interface | ||
| { | ||
| internal interface IXmlRunSettings | ||
| { | ||
| Dictionary<string, object> GetTestRunParameters(string? settingsXml); | ||
| Dictionary<string, object> GetNUnitParameters(string? settingsXml); | ||
| } | ||
| } |
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
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.