Class: Fastlane::Actions::FlutterTestsAction::Test
- Inherits:
-
Object
- Object
- Fastlane::Actions::FlutterTestsAction::Test
- Defined in:
- lib/fastlane/plugin/flutter_tests/actions/flutter_tests_action.rb
Overview
Class that represents a single test that has been run
Instance Method Summary collapse
- #_generate_message ⇒ Object
- #can_print ⇒ Object
- #get_id ⇒ Object
- #get_name ⇒ Object
- #get_status ⇒ Object
-
#initialize(id, name) ⇒ Test
constructor
A new instance of Test.
- #mark_as_done(success, skipped, error, stacktrace) ⇒ Object
- #print ⇒ Object
Constructor Details
#initialize(id, name) ⇒ Test
Returns a new instance of Test.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fastlane/plugin/flutter_tests/actions/flutter_tests_action.rb', line 11 def initialize(id, name) @test_id = id @test_name = name @test_done = false @test_successful = '' @test_error = nil @test_stacktrace = nil @test_was_skipped = false @test_was_printed = false end |
Instance Method Details
#_generate_message ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/fastlane/plugin/flutter_tests/actions/flutter_tests_action.rb', line 53 def tag = @test_was_skipped ? 'skipped' : @test_successful = "[#{tag}] #{@test_name}" if @test_successful != 'success' += "\n[ERROR] -> #{@test_error}\n[STACKTRACE]\n#{@test_stacktrace}" end if %w[success error].include?(@test_successful) || @test_was_skipped color = if @test_was_skipped 34 # Skipped tests are displayed in blue else # Successful tests are in green and the failed in red @test_successful == 'success' ? 32 : 31 end "\e[#{color}m#{}\e[0m" else end end |
#can_print ⇒ Object
41 42 43 |
# File 'lib/fastlane/plugin/flutter_tests/actions/flutter_tests_action.rb', line 41 def can_print !@test_was_printed end |
#get_id ⇒ Object
37 38 39 |
# File 'lib/fastlane/plugin/flutter_tests/actions/flutter_tests_action.rb', line 37 def get_id @test_id end |
#get_name ⇒ Object
33 34 35 |
# File 'lib/fastlane/plugin/flutter_tests/actions/flutter_tests_action.rb', line 33 def get_name @test_name end |
#get_status ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/fastlane/plugin/flutter_tests/actions/flutter_tests_action.rb', line 45 def get_status if @test_was_skipped 'skipped' else @test_successful end end |
#mark_as_done(success, skipped, error, stacktrace) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fastlane/plugin/flutter_tests/actions/flutter_tests_action.rb', line 22 def mark_as_done(success, skipped, error, stacktrace) @test_done = true @test_successful = success @test_was_skipped = skipped @test_error = error unless stacktrace.nil? stacktrace = stacktrace.gsub(/ {2,}/, "\n") @test_stacktrace = stacktrace end end |
#print ⇒ Object
75 76 77 78 |
# File 'lib/fastlane/plugin/flutter_tests/actions/flutter_tests_action.rb', line 75 def print UI.() @test_was_printed = true end |