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-7950] Add rspec instrumentation for test suite level visibility #86

Merged
merged 10 commits into from
Dec 13, 2023

Conversation

anmarchenko
Copy link
Member

@anmarchenko anmarchenko commented Dec 7, 2023

What does this PR do?
Adds RSpec instrumentation for test suite level visibility

Additional Notes
This change is mostly compatible with current rspec instrumentation except one important change:
test suite name for a test is now metadata[:example_group][:rerun_file_path] instead of metadata[:example_group][:file_path]. The reason for that is if ExampleGroup is defined in shared examples inside a context like that:

RSpec.shared_examples "Testing shared examples" do
  context "shared examples" do
    it "adds 1 and 1" do
      expect(1 + 1).to eq(2)
    end
  end
end

...then file_path contains the path of shared examples file whereas rerun_file_path contains the path of test file.

How to test the change?
There are open source projects I used for testing:
https://github.com/anmarchenko/middleman
https://github.com/anmarchenko/rubocop
https://github.com/anmarchenko/vagrant

Example of sesison trace for middleman specs:
image

@codecov-commenter
Copy link

codecov-commenter commented Dec 7, 2023

Codecov Report

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

Comparison is base (b8c4124) 99.13% compared to head (b77fe2c) 99.10%.

Files Patch % Lines
lib/datadog/ci/test_visibility/recorder.rb 75.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #86      +/-   ##
==========================================
- Coverage   99.13%   99.10%   -0.03%     
==========================================
  Files         135      137       +2     
  Lines        5226     5391     +165     
  Branches      189      207      +18     
==========================================
+ Hits         5181     5343     +162     
- Misses         45       48       +3     

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

@anmarchenko anmarchenko force-pushed the anmarchenko/rspec_instrumentation branch from 3e02daa to 4fc8c38 Compare December 11, 2023 10:48
@anmarchenko anmarchenko marked this pull request as ready for review December 12, 2023 14:22
@anmarchenko anmarchenko requested review from a team and ericlaz December 12, 2023 14:22
@anmarchenko anmarchenko merged commit d58510f into main Dec 13, 2023
11 checks passed
@anmarchenko anmarchenko deleted the anmarchenko/rspec_instrumentation branch December 13, 2023 15:08
@github-actions github-actions bot added this to the 0.6.0 milestone Dec 13, 2023
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.

3 participants