Class: Xcode::Test::Parsers::KIFParser
- Inherits:
-
Object
- Object
- Xcode::Test::Parsers::KIFParser
- Defined in:
- lib/xcode/test/parsers/kif_parser.rb
Instance Attribute Summary collapse
-
#builder ⇒ Object
Returns the value of attribute builder.
-
#report ⇒ Object
Returns the value of attribute report.
Instance Method Summary collapse
- #<<(piped_row) ⇒ Object
- #flush ⇒ Object
-
#initialize(report = Xcode::Test::Report.new) {|_self| ... } ⇒ KIFParser
constructor
A new instance of KIFParser.
Constructor Details
#initialize(report = Xcode::Test::Report.new) {|_self| ... } ⇒ KIFParser
Returns a new instance of KIFParser.
11 12 13 14 15 |
# File 'lib/xcode/test/parsers/kif_parser.rb', line 11 def initialize(report = Xcode::Test::Report.new) @report = report @awaiting_scenario_name = false yield self if block_given? end |
Instance Attribute Details
#builder ⇒ Object
Returns the value of attribute builder.
9 10 11 |
# File 'lib/xcode/test/parsers/kif_parser.rb', line 9 def builder @builder end |
#report ⇒ Object
Returns the value of attribute report.
9 10 11 |
# File 'lib/xcode/test/parsers/kif_parser.rb', line 9 def report @report end |
Instance Method Details
#<<(piped_row) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/xcode/test/parsers/kif_parser.rb', line 21 def <<(piped_row) if @awaiting_scenario_name if match = piped_row.match(/\[\d+\:.+\]\s(.+)/) name = match[1].strip @report.add_suite name, Time.now @awaiting_scenario_name = false end return end case piped_row.force_encoding("UTF-8") when /BEGIN KIF TEST RUN: (\d+) scenarios/ @report.start when /BEGIN SCENARIO (\d+)\/(\d+) \(\d+ steps\)/ @awaiting_scenario_name = true when /END OF SCENARIO \(duration (\d+\.\d+)s/ @report.in_current_suite do |suite| suite.finish(Time.now) end when /(PASS|FAIL) \((\d+\.\d+s)\): (.+)/ duration = $2.to_f name = $3.strip @report.in_current_suite do |suite| test = suite.add_test_case(name) if $1 == 'PASS' test.passed(duration) else test.failed(duration) end end when /KIF TEST RUN FINISHED: \d+ failures \(duration (\d+\.\d+)s\)/ @report.finish when /(.*): error: -\[(\S+) (\S+)\] : (.*)/ = $4 location = $1 @report.in_current_test do |test| test.add_error(, location) end # when /failed with exit code (\d+)/, when /BUILD FAILED/ @report.finish when /Segmentation fault/ @report.abort when /the iPhoneSimulator platform does not currently support application-hosted tests/ raise "Application tests are not currently supported by the iphone simulator. If these are logic tests, try unsetting TEST_HOST in your project config" else @report.in_current_test do |test| test << piped_row end end # case end |
#flush ⇒ Object
17 18 19 |
# File 'lib/xcode/test/parsers/kif_parser.rb', line 17 def flush @report.finish end |