Skip to content

Commit

Permalink
include runid TestCasePayload (#39)
Browse files Browse the repository at this point in the history
Co-authored-by: psomangali <[email protected]>
  • Loading branch information
priyasomangali and psomangali authored Aug 22, 2023
1 parent c094a88 commit 912de6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Agoda.Tests.Metrics.Tests/TestCasePayloadTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ public void WhenInit_ShouldHaveDefaultVarsFromEnvironment()
#pragma warning restore AG0035
underTest.Platform.ShouldBe((int)Environment.OSVersion.Platform);
underTest.Os.ShouldBe(Environment.OSVersion.VersionString);
underTest.RunId.ShouldNotBeNull();
}
}
12 changes: 12 additions & 0 deletions src/Agoda.Tests.Metrics/TestCasePayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ public TestCasePayload(string metricsVersion, GitContext gitContext, IList<TestC
Branch = gitContext.BranchName;
NUnitTestCases = testCases.ToList();
IsDebuggerAttached = System.Diagnostics.Debugger.IsAttached;
var ciJobId = Environment.GetEnvironmentVariable("CI_JOB_ID");
if (!string.IsNullOrEmpty(ciJobId))
{
RunId = ciJobId;
}
else
{
RunId = Guid.NewGuid().ToString();
}
}

public bool IsDebuggerAttached { get; set; }
Expand All @@ -49,5 +58,8 @@ public TestCasePayload(string metricsVersion, GitContext gitContext, IList<TestC
public string RepositoryName { get; set; }

public IList<TestCase> NUnitTestCases { get; set; }

public string RunId { get; set; }

}
}

0 comments on commit 912de6d

Please sign in to comment.