Consolidate push/PR test runs into single dotnet test invocation for one HTML report#3
Merged
Merged
Conversation
- Replace two separate push/PR dotnet test steps with a single step (no --filter, with continue-on-error: true) so Reqnroll fires [BeforeTestRun] only once and produces one HTML report - Add LogKnownFailure() and MarkTestAsKnownFailure() to ExtentReportHelper to log intentional failures as Warning (orange) instead of Fail (red) - Update AfterScenario and AfterStep hooks to detect @intentional-fail tag and use Warning-based reporting; extract tag string to a constant Co-authored-by: srmiljus <81557246+srmiljus@users.noreply.github.com> Agent-Logs-Url: https://github.com/srmiljus/Notch_Automation_Task/sessions/5d972fa1-8498-48f9-ab4b-7a0909c8159f
Copilot
AI
changed the title
[WIP] Consolidate test reports into a single HTML output
Consolidate push/PR test runs into single dotnet test invocation for one HTML report
Mar 26, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two separate
dotnet teststeps on push/PR each triggered[BeforeTestRun], causingExtentReportHelperto initialize twice and produce two timestamped HTML artifacts instead of one consolidated report.Workflow (
tests.yml)dotnet teststep withcontinue-on-error: true— one process, one[BeforeTestRun], one reportExtentReportHelper
LogKnownFailure(string)— logs withWarningstatus and[EXPECTED FAILURE]prefixMarkTestAsKnownFailure(string)— logs a⚠️ [KNOWN / EXPECTED FAILURE]warning on the test node itself, which drives ExtentReports to render the test as orange (Warning) rather than red (Fail)Hooks
"intentional-fail"toprivate const string IntentionalFailTagAfterStep: detects@intentional-fail→ callsLogWarninginstead ofLogFailfor the failing stepAfterScenario: detects@intentional-fail→ uses"EXPECTED FAIL"screenshot label and callsMarkTestAsKnownFailureinstead of treating the error as a genuine failureNet result: one HTML report per CI run; regular tests ✅ green,⚠️ orange with clear label, pipeline stays green.
intentional-failOriginal prompt
Problem
When the workflow runs on
pushorpull_request, two separatedotnet teststeps are executed:Run tests excluding intentional-fail (push/PR)— runs all tests except@intentional-failRun intentional-fail test (push/PR - expected to fail)— runs only@intentional-failBecause Reqnroll fires
[BeforeTestRun]once per process, eachdotnet testinvocation initializesExtentReportHelperseparately and creates its own timestamped HTML report. This results in two uploaded artifacts — one per test run — which is unprofessional.Goal
Produce one single consolidated HTML report per CI run where:
intentional-failscenario shows as[EXPECTED FAILURE]label — not as a red FailChanges Required
1.
.github/workflows/tests.ymlReplace the two separate push/PR test steps with a single
dotnet teststep that runs all tests together withcontinue-on-error: true.The current two steps to replace:
Replace with a single step:
2.
NotchContactFormTests/NotchContactFormTests/Helpers/ExtentReportHelper.csAdd a
LogKnownFailure(string message)method that logs withWarningstatus:Also add a
MarkTestAsKnownFailure(string reason)method that marks the current test node itself as Warning status with a clear label. In ExtentReports, a test's final status is determined by the highest-severity log entry — so logging a Warning (instead of Fail) will make the test show as Warning/orange rather than red Fail.Add:
3.
NotchContactFormTests/NotchContactFormTests/Hooks/Hooks.csIn the
AfterScenariohook, detect whether the failing scenario has the@intentional-failtag. If it does, callMarkTestAsKnownFailureinstead ofLogFail, so the report shows it as Warning (orange) instead of Fail (red).Current
AfterScenario:Update to: