Skip to content

Make the RSpec JSON formatter more like the JUnit formatter

What does this MR do?

This include 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.

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.

After this change all the info will be exposed. A gitlab-qa MR is needed to include it in the reports: gitlab-qa!518 (merged)

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

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Mark Lapierre

Merge request reports

Loading