-
Notifications
You must be signed in to change notification settings - Fork 6
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
OSOE-59: Make UI Testing Toolbox UITestManifest more generic step 1 #114
Merged
Merged
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
0336c69
Making TeamCiry metadata reporting more flexible
Piedone 4db86d9
Removing the parameters from the test name for TC metadata reporting,…
Piedone e5e3d29
Refactoring UITestManifest
Piedone 5d7f0ff
Testing TC metadata name
Piedone 293b37b
More TC metadata name variations as a test
Piedone c63faf4
Typo
Piedone a50a5d5
Typo
Piedone 52e4d6a
Trying to report without test name too
Piedone 444c383
More TC metadata reporting exploration
Piedone f3b86f8
Code styling
Piedone 6d925bf
Fixing metadata type
Piedone 7567eba
More metadata name formats
Piedone 03c2efd
More TC metadata testing
Piedone a82e6a5
More TC metadata testing
Piedone 5e27d4c
Implementing fixed TeamCity metadata reporting
Piedone 54bf10d
And again
Piedone 1e6fdd0
Merge remote-tracking branch 'origin/dev' into issue/OSOE-59
Piedone 869c073
Merge remote-tracking branch 'origin/dev' into issue/OSOE-59
Piedone 36df112
Making the UITestManifest available in the UITestContext too
Piedone 199be34
Reporting TC metadata via ITestOutputHelper
Piedone 1e233e8
Revert TeamCityMetadataReporter
Piedone 1cddb0b
Using JetBrains-provided TC metadata escaping logic
Piedone 8c40589
Intentionally failing test
Piedone aeb8ec7
Reverting TC metadata name generation logic
Piedone d06a596
Attempting TC metadata reporting with enums in quotes
Piedone 8fa6064
Merge branch 'dev' into issue/OSOE-59
Piedone 3ef3f2d
Only debug BasicTests remains
Piedone cb51ecf
Revert "Only debug BasicTests remains"
Piedone 774b995
Merge branch 'dev' into issue/OSOE-59
Piedone 4066b5f
Removing debug code from test name generation for TC metadata
Piedone 294d142
Merge remote-tracking branch 'origin/dev' into issue/OSOE-59
Piedone 980a4c5
Debug code for temporarily prefixing TC metadata
Piedone 034d376
Revert "Debug code for temporarily prefixing TC metadata"
Piedone 2865f77
Merge branch 'dev' into issue/OSOE-59
Piedone 87ecb37
Adding TeamCity.VSTest.TestAdapter in attempt to fix TC metadata not …
Piedone e6f9d7e
Writing TC metadata with ITestOutputHelper instead
Piedone dda4e18
Adding debug TC metadata prefix
Piedone 6436bda
Fixing analyzer violation
Piedone 5b9e4c8
Revert "Adding debug TC metadata prefix"
Piedone f6a58d8
Removing all but a debug test
Piedone a9ee479
Making one debug test fail
Piedone 49f4273
Merge branch 'dev' into issue/OSOE-59
Piedone fe83523
Removing "Lombiq.Tests.UI.Samples: " prefix from TC metadata
Piedone 479a08a
Restoring sample tests
Piedone 22d8c92
Merge branch 'dev' into issue/OSOE-59
Piedone 715684d
Writing TC metadata to the console again
Piedone 56f4db1
Revert "Adding TeamCity.VSTest.TestAdapter in attempt to fix TC metad…
Piedone c606e84
Let's see if TC metadata reporting works with TestOutputHelper withou…
Piedone 534c5f1
Adding TeamCity.VSTest.TestAdapter and debug TC metadata prefix
Piedone 7206430
Merge remote-tracking branch 'origin/dev' into issue/OSOE-59
BenedekFarkas 60f7b13
Setting IsPublishable to false on the projects that don't actually co…
BenedekFarkas 2e4a0a1
Merge branch 'dev' into issue/OSOE-59
Piedone a59fed7
Typo
Piedone 7623719
TeamCityMetadataReporter: Removing double encoding from testname
BenedekFarkas 6f11884
TeamCityMetadataReporter: Fixing escaping for NewLine character
BenedekFarkas 46af8e6
TeamCityMetadataReporter: Removing debug code
BenedekFarkas 37f7734
Revert "TeamCityMetadataReporter: Removing debug code"
BenedekFarkas 42cb956
Moving "Lombiq.Tests.UI.Samples: " prefix in the service message in f…
BenedekFarkas 09ebbed
Merge remote-tracking branch 'origin/dev' into issue/OSOE-59
Piedone ec84b85
Removing duplicated IsPublishable
Piedone 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ public Task AnonymousHomePageShouldExist(Browser browser) => | |
{ | ||
// Is the title correct? | ||
context | ||
.Get(By.ClassName("navbar-brand")) | ||
.Get(By.ClassName("navbar-brandsdfds")) | ||
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. Debug code needs to be removed. |
||
.Text | ||
.ShouldBe("Lombiq's OSOCE - UI Testing"); | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
using Lombiq.Tests.UI.Services; | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using Xunit.Abstractions; | ||
|
||
namespace Lombiq.Tests.UI.Models; | ||
|
||
/// <summary> | ||
/// Provides data about the currently executing test. | ||
/// </summary> | ||
public class UITestManifest | ||
{ | ||
public string Name { get; set; } | ||
public ITestOutputHelper TestOutputHelper { get; } | ||
public ITest XunitTest { get; } | ||
public string Name => XunitTest.DisplayName; | ||
public Func<UITestContext, Task> TestAsync { get; set; } | ||
|
||
public UITestManifest(ITestOutputHelper testOutputHelper) | ||
{ | ||
TestOutputHelper = testOutputHelper; | ||
|
||
XunitTest = testOutputHelper.GetType() | ||
.GetFields(BindingFlags.NonPublic | BindingFlags.Instance) | ||
.FirstOrDefault(field => field.FieldType == typeof(ITest)) | ||
?.GetValue(testOutputHelper) as ITest; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
using Lombiq.Tests.UI.Models; | ||
using System; | ||
using System.IO; | ||
|
||
|
@@ -15,32 +16,31 @@ namespace Lombiq.Tests.UI.Services; | |
/// </remarks> | ||
public static class TeamCityMetadataReporter | ||
{ | ||
public static void ReportInt(string testName, string name, int number) => | ||
ReportNumber(testName, name, number.ToTechnicalString()); | ||
public static void ReportInt(UITestManifest uiTestManifest, string name, int number) => | ||
ReportNumber(uiTestManifest, name, number.ToTechnicalString()); | ||
|
||
public static void ReportNumber(string testName, string name, string number) => | ||
Report(testName, name, "number", number); | ||
public static void ReportNumber(UITestManifest uiTestManifest, string name, string number) => | ||
Report(uiTestManifest, name, "number", number); | ||
|
||
public static void ReportText(string testName, string name, string text) => | ||
Report(testName, name, "text", text); | ||
public static void ReportText(UITestManifest uiTestManifest, string name, string text) => | ||
Report(uiTestManifest, name, "text", text); | ||
|
||
public static void ReportExternalLink(string testName, string name, string url) => | ||
Report(testName, name, "link", url); | ||
public static void ReportExternalLink(UITestManifest uiTestManifest, string name, string url) => | ||
Report(uiTestManifest, name, "link", url); | ||
|
||
public static void ReportArtifactLink(string testName, string name, string artifactPath) => | ||
Report(testName, name, "artifact", PreparePath(artifactPath)); | ||
public static void ReportArtifactLink(UITestManifest uiTestManifest, string name, string artifactPath) => | ||
Report(uiTestManifest, name, "artifact", PreparePath(artifactPath)); | ||
|
||
public static void ReportImage(string testName, string name, string imageArtifactPath) => | ||
Report(testName, name, "image", PreparePath(imageArtifactPath)); | ||
public static void ReportImage(UITestManifest uiTestManifest, string name, string imageArtifactPath) => | ||
Report(uiTestManifest, name, "image", PreparePath(imageArtifactPath)); | ||
|
||
public static void ReportVideo(string testName, string name, string videoArtifactPath) => | ||
Report(testName, name, "video", PreparePath(videoArtifactPath)); | ||
public static void ReportVideo(UITestManifest uiTestManifest, string name, string videoArtifactPath) => | ||
Report(uiTestManifest, name, "video", PreparePath(videoArtifactPath)); | ||
|
||
public static void Report(string testName, string name, string type, string value) => | ||
// Starting with a line break is sometimes necessary not to mix up these messages in the build output. | ||
Console.WriteLine( | ||
Environment.NewLine + | ||
$"##teamcity[testMetadata testName='{Escape(testName)}' name='{Escape(name)}' type='{type}' value='{Escape(value)}']"); | ||
public static void Report(UITestManifest uiTestManifest, string name, string type, string value) => | ||
uiTestManifest.TestOutputHelper.WriteLine( | ||
$"##teamcity[testMetadata testName='Lombiq.Tests.UI.Samples: {Escape(uiTestManifest.Name)}' " + | ||
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. Debug "Lombiq.Tests.UI.Samples:" prefix needs to be removed. |
||
$"name='{Escape(name)}' type='{type}' value='{Escape(value)}']"); | ||
|
||
// TeamCity needs forward slashes to replacing backslashes if the platform uses that. | ||
private static string PreparePath(string artifactPath) => artifactPath.Replace(Path.DirectorySeparatorChar, '/'); | ||
|
@@ -49,7 +49,7 @@ public static void Report(string testName, string name, string type, string valu | |
private static string Escape(string value) => value | ||
.Replace("|", "||", StringComparison.Ordinal) | ||
.Replace("'", "|'", StringComparison.Ordinal) | ||
.Replace("\n", "n", StringComparison.Ordinal) | ||
.Replace("\n", "|n", StringComparison.Ordinal) | ||
.Replace("\r", "|r", StringComparison.Ordinal) | ||
.Replace(@"\uNNNN", "|0xNNNN", StringComparison.Ordinal) | ||
.Replace("[", "|[", StringComparison.Ordinal) | ||
|
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
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.
Need to add this to the wiki if it remains necessary.