Skip to content

Commit

Permalink
Add a test plan skip message to commons
Browse files Browse the repository at this point in the history
  • Loading branch information
delatrie committed Mar 27, 2024
1 parent 66fbbd9 commit 35aeded
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Allure.Net.Commons/TestPlan/AllureTestPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ public static AllureTestPlan FromEnvironment()
/// </summary>
public static readonly AllureTestPlan DEFAULT_TESTPLAN = new();

static string? ResolveTestPlanPath() =>
/// <summary>
/// Returns the path of the current test plan file, if any.
/// </summary>
public static string? ResolveTestPlanPath() =>
new[]
{
AllureConstants.NEW_ALLURE_TESTPLAN_ENV_NAME,
Expand All @@ -95,6 +98,13 @@ public static AllureTestPlan FromEnvironment()
ev => !string.IsNullOrWhiteSpace(ev)
).FirstOrDefault();

/// <summary>
/// A short message that can be used to report an ignored test to the test
/// framework.
/// </summary>
public static string SkipReason =>
"Not in the test plan " + (ResolveTestPlanPath() ?? "");

static AllureTestPlan GetTestPlanByPath(string? testPlanPath) =>
testPlanPath is null || !File.Exists(testPlanPath)
? DEFAULT_TESTPLAN
Expand Down

0 comments on commit 35aeded

Please sign in to comment.