fix(cucumberjs): use scenario line in testCaseId to prevent duplicate name collision#1502
Open
todti wants to merge 4 commits into
Open
fix(cucumberjs): use scenario line in testCaseId to prevent duplicate name collision#1502todti wants to merge 4 commits into
todti wants to merge 4 commits into
Conversation
…licate scenario names When two `Scenario` blocks in the same feature file share an identical name, the reporter was producing the same `testCaseId` for both. allure-report deduplicates results by `testCaseId`, so one test was silently dropped from the HTML report (N-1 tests shown instead of N). Fix: include `scenario.location.line` in the md5 input for `testCaseId`. Scenarios with the same name but different line numbers now get distinct ids. Scenario Outline rows are unaffected — all rows of one outline share the same line and therefore keep the same `testCaseId`, which is required for cross-run history tracking. BREAKING CHANGE: `testCaseId` changes for every test because the hash input gains a `#<line>` suffix. Existing allure history tied to the old hash will be lost after upgrading. `_fallbackTestCaseId` (`legacyTestCaseId`) is unchanged to preserve the allure2→allure3 migration path. Fixes #1387
9af0581 to
d1e5409
Compare
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.
Problem
Fixes #1387.
When two
Scenarioblocks in the same feature file share an identical name (but have different steps), the reporter computed the sametestCaseIdfor both:allure-report(the Java/HTML generator) deduplicates test results bytestCaseId, so one of the two tests was silently dropped from the report — users saw N-1 tests instead of N. All other reporters (JSON, JUnit XML, HTML) were unaffected because they don't deduplicate.Fix
Include
scenario.location.linein thetestCaseIdhash. Two scenarios with the same name but on different lines now get distinct ids:Scenario Outline rows are unaffected — all rows of one outline share the same
Scenario Outline:line number, so they keep the sametestCaseId. This is required for cross-run history tracking (you want to see the history of "row 1 of this outline" across multiple runs, not treat each run as a fresh test).Breaking Change
testCaseIdchanges for every test in every feature file, because the hash input gains a#<line>suffix. Existing allure history tied to the old hash will be lost after upgrading — the first run after the upgrade will appear as a new test with no history._fallbackTestCaseId(thelegacyTestCaseIdused for allure2 → allure3 history migration) is unchanged, so the migration path from older allure versions is preserved.Testing
Added
duplicate-names.featurewith twoScenario: same nameblocks and a new test asserting they produce differenttestCaseIdvalues. The existing test for Scenario Outline (should create same test case id for scenario outline tests with template name) continues to pass.