Skip to content

Make the RSpec JSON formatter more like the JUnit formatter

This includes the error and stacktrace as they're presented by the JUnit RSpec formatter (which is also more similar to the RSpec failure output we're used to).

This will also help fix the problem of info in the job logs missing from testcase issue comments.

This depends on the changes in gitlab!40569 (merged).

For example, RSpec outputs something like:

2) Monitor creates an incident template and opens an incident with template applied
     Failure/Error: raise Capybara::ElementNotFound, "Unable to find #{query.applied_description}" if result.empty?
     
     Capybara::ElementNotFound:
       Unable to find css "[data-qa-selector=\"job_log_content\"],.qa-job-log-content"
     # ./qa/specs/features/ee/browser_ui/8_monitor/cluster_with_prometheus.rb:23:in `block (2 levels) in <module:QA>'

But the testcase issue reporter was only reporting some of the info:

Error:
```
Capybara::ElementNotFound: Unable to find css "[data-qa-selector=\"job_log_content\"],.qa-job-log-content"
```

Stacktrace:
```
/usr/local/bundle/gems/capybara-3.29.0/lib/capybara/node/finders.rb:296:in `block in synced_resolve'
```

So if someone tried to find that failure in the testcase issue by searching for "Unable to find #{query.applied_description}", they wouldn't find it.

Part of https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/632

Edited by Mark Lapierre

Merge request reports

Loading