-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(playwrighttesting): populate NumberOfTestWorkers from runsettin…
…gs and refactor PlaywrightReporter (#47066) * chore(playwrighttesting): populate NumberOfTestWorkers from runsettings and refactor PlaywrightReporter * chore(): update api spec --------- Co-authored-by: Siddharth Singha Roy <ssingharoy@microsoft.com>
- Loading branch information
Showing
16 changed files
with
542 additions
and
87 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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.