Skip to content

Commit

Permalink
Add "Running tests crash because of an uncaught exception" scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Oct 8, 2015
1 parent a119c28 commit bf99910
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions features/simple_format.feature
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,9 @@ Feature: Showing build output in simple format
When I pipe to xcpretty with "--simple --color"
Then I should see a yellow warning message

Scenario: Running tests crash because of an uncaught exception
Given tests fail with an uncaught exception
When I pipe to xcpretty with "--simple --color"
Then I should see a crash symbol and the test case in red
And I should see the exception name and reason
And I should see the call stack that led to the exception
19 changes: 19 additions & 0 deletions features/steps/formatting_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
add_run_input SAMPLE_UNDEFINED_SYMBOLS
end

Given(/^tests fail with an uncaught exception$/) do
add_run_input SAMPLE_UNCAUGHT_EXCEPTION
end

Given(/^I have a pending test in my suite$/) do
add_run_input SAMPLE_PENDING_KIWI_TEST
end
Expand Down Expand Up @@ -296,6 +300,21 @@
run_output.should include("objc-class-ref in ATZRadialProgressControl.o")
end

Then(/^I should see a crash symbol and the test case in red$/) do
run_output.should include(red("💥 testRaisingUncaughtException"))
end

Then(/^I should see the exception name and reason$/) do
run_output.should include("NSInvalidArgumentException: -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]")
end

Then(/^I should see the call stack that led to the exception$/) do
run_output.should include("\t0 CoreFoundation 0x0000000109479a75 __exceptionPreprocess + 165")
run_output.should include("\t1 libobjc.A.dylib 0x0000000109112bb7 objc_exception_throw + 45")
run_output.should include("\t2 CoreFoundation 0x000000010938503f -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 383")
run_output.should include("\t3 CoreFoundation 0x0000000109397d8b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59")
end

Then(/^I should see the name of a pending test$/) do
run_output.should =~ PENDING_TEST_NAME_MATCHER
end
Expand Down

0 comments on commit bf99910

Please sign in to comment.