mirror of
https://github.com/discourse/discourse.git
synced 2026-07-29 15:54:48 -05:00
DEV: Include exception details for each test in flaky tests report (#24892)
Why this change? The exception message and name is useful when analyzing why a test failed.
This commit is contained in:
@@ -34,6 +34,14 @@ module TurboTests
|
|||||||
@failed_example.location_rerun_argument
|
@failed_example.location_rerun_argument
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def exception_name
|
||||||
|
@failed_example.execution_result.exception.class.name
|
||||||
|
end
|
||||||
|
|
||||||
|
def exception_message
|
||||||
|
@failed_example.execution_result.exception.message
|
||||||
|
end
|
||||||
|
|
||||||
SCREENSHOT_PREFIX = "[Screenshot Image]: "
|
SCREENSHOT_PREFIX = "[Screenshot Image]: "
|
||||||
|
|
||||||
# Unfortunately this has to be parsed from the output because `ActionDispatch` is just printing the path instead of
|
# Unfortunately this has to be parsed from the output because `ActionDispatch` is just printing the path instead of
|
||||||
@@ -56,6 +64,8 @@ module TurboTests
|
|||||||
{
|
{
|
||||||
message_lines:,
|
message_lines:,
|
||||||
description:,
|
description:,
|
||||||
|
exception_message:,
|
||||||
|
exception_name:,
|
||||||
backtrace:,
|
backtrace:,
|
||||||
failure_screenshot_path:,
|
failure_screenshot_path:,
|
||||||
location_rerun_argument:,
|
location_rerun_argument:,
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ RSpec.describe TurboTests::Flaky::Manager do
|
|||||||
"message_lines" =>
|
"message_lines" =>
|
||||||
"Failure/Error: Unable to infer file and line number from backtrace\n\nStandardError:\n some error\n\n [Screenshot Image]: /some/path/to/screenshot.png",
|
"Failure/Error: Unable to infer file and line number from backtrace\n\nStandardError:\n some error\n\n [Screenshot Image]: /some/path/to/screenshot.png",
|
||||||
"description" => "rspec example 1",
|
"description" => "rspec example 1",
|
||||||
|
"exception_message" =>
|
||||||
|
"some error\n\n[Screenshot Image]: /some/path/to/screenshot.png",
|
||||||
|
"exception_name" => "StandardError",
|
||||||
"backtrace" => ["some backtrace"],
|
"backtrace" => ["some backtrace"],
|
||||||
"failure_screenshot_path" => "/some/path/to/screenshot.png",
|
"failure_screenshot_path" => "/some/path/to/screenshot.png",
|
||||||
"location_rerun_argument" => "./spec/lib/turbo_tests/flaky/manager_spec.rb:7",
|
"location_rerun_argument" => "./spec/lib/turbo_tests/flaky/manager_spec.rb:7",
|
||||||
@@ -88,6 +91,8 @@ RSpec.describe TurboTests::Flaky::Manager do
|
|||||||
"message_lines" =>
|
"message_lines" =>
|
||||||
"Failure/Error: Unable to infer file and line number from backtrace\n\nStandardError:\n some error",
|
"Failure/Error: Unable to infer file and line number from backtrace\n\nStandardError:\n some error",
|
||||||
"description" => "rspec example 2",
|
"description" => "rspec example 2",
|
||||||
|
"exception_message" => "some error",
|
||||||
|
"exception_name" => "StandardError",
|
||||||
"backtrace" => ["some backtrace"],
|
"backtrace" => ["some backtrace"],
|
||||||
"failure_screenshot_path" => nil,
|
"failure_screenshot_path" => nil,
|
||||||
"location_rerun_argument" => "./spec/lib/turbo_tests/flaky/manager_spec.rb:22",
|
"location_rerun_argument" => "./spec/lib/turbo_tests/flaky/manager_spec.rb:22",
|
||||||
|
|||||||
Reference in New Issue
Block a user