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:
Alan Guo Xiang Tan
2023-12-14 11:11:11 +08:00
committed by GitHub
parent 53d40672a7
commit c437b9f5f2
2 changed files with 15 additions and 0 deletions
+10
View File
@@ -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",