Skip to content
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

[CIVIS-7722] Parametrized tests support for cucumber #100

Merged
merged 4 commits into from
Jan 11, 2024

Conversation

anmarchenko
Copy link
Contributor

@anmarchenko anmarchenko commented Jan 10, 2024

What does this PR do?
Adds parametrized test support for cucumber-rby (version 4 and above):
image

Motivation
Currently all test runs with scenario outline have the same test fingerprint and treated as a single test being run multiple times. We should use test.parameters tag to distinguish these tests from each other

Additional Notes

  • Cucumber 3.0 does not have a way to extract examples but in Cucumber 3.0 all scenario outline runs have "(Example #N)" prefix so they are unique
  • JSON hash is set using JSON.stringify because Cucumebr examples are built using strings, so I am sure that these parameters have proper string representations

How to test the change?
Tested using https://github.com/anmarchenko/jekyll

@anmarchenko anmarchenko changed the title Parametrized tests support for cucumber [CIVIS-7722] Parametrized tests support for cucumber Jan 10, 2024
@anmarchenko anmarchenko force-pushed the anmarchenko/parametrized_cucumber_tests branch from 3338929 to 46ce917 Compare January 10, 2024 14:28
@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (de794cb) 99.19% compared to head (fd793ad) 99.15%.

Files Patch % Lines
lib/datadog/ci/contrib/cucumber/formatter.rb 84.21% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #100      +/-   ##
==========================================
- Coverage   99.19%   99.15%   -0.05%     
==========================================
  Files         147      147              
  Lines        6242     6284      +42     
  Branches      256      264       +8     
==========================================
+ Hits         6192     6231      +39     
- Misses         50       53       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anmarchenko anmarchenko marked this pull request as ready for review January 11, 2024 11:45
@anmarchenko anmarchenko requested review from a team as code owners January 11, 2024 11:45
expect(span.get_tag(Datadog::CI::Ext::Test::TAG_NAME)).to eq("scenario with examples")

expect(span.get_tag(Datadog::CI::Ext::Test::TAG_PARAMETERS)).to eq(
"{\"num1\":\"#{index}\",\"num2\":\"#{index + 1}\",\"total\":\"#{index + index + 1}\"}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the UI render these parameters correctly? The format the other tracers follow is

{
  "arguments": // ... your parameters
  "metadata": { // ... extra metadata }
}
Screenshot 2024-01-11 at 13 03 33

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on it, UI is handling it correctly:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anmarchenko anmarchenko merged commit a94f9de into main Jan 11, 2024
26 checks passed
@anmarchenko anmarchenko deleted the anmarchenko/parametrized_cucumber_tests branch January 11, 2024 15:25
@github-actions github-actions bot added this to the 0.7.0 milestone Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants