Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Unit testing on iPhone fails
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 26 - 30 of 30 - Collapse all  -  Translate all to Translated (View all originals) < Older 
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Justin DeWind  
View profile   Translate to Translated (View Original)
 More options Jul 1 2010, 3:45 pm
From: Justin DeWind <dewi...@gmail.com>
Date: Thu, 1 Jul 2010 15:45:59 -0400
Local: Thurs, Jul 1 2010 3:45 pm
Subject: Re: Unit testing on iPhone fails

Thanks Dave,

It looks like we are almost there. It seems that normal test failures are
caught appropriately now. However, other exceptions are making there way up
there. Alas, OCMock checks and Hamcrest assertions are bubbling to the top
still -- this was working before.

Hamcrest: 2010-07-01 15:36:15.458 Tests[30200:903] *** Terminating app due
to uncaught exception 'SenTestFailureException', reason: 'Expected "world",
got "hello"'

OCMock: 2010-07-01 15:39:30.206 Tests[30312:903] *** Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason:
'OCMockObject[NSString]: unexpected method invoked:
stringByAppendingString:@"hello" '

I imagine this is the result of some underlying changes in iOS4 in how
exceptions are handled via dynamic invocation. I.E., you can't catch some of
them. Frustrating, indeed. I have added these as tests cases to the project.

On another front. Removing the Main nib file base name entry in the tests
info property list avoids the problem of having to include all of your
resources.

You have been very helpful. I have 3-4 projects that went from being unable
to run any tests to at least being able to work through them.

Justin DeWind

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin DeWind  
View profile  
 More options Jul 2 2010, 9:45 am
From: Justin DeWind <dewi...@gmail.com>
Date: Fri, 2 Jul 2010 09:45:57 -0400
Local: Fri, Jul 2 2010 9:45 am
Subject: Re: Unit testing on iPhone fails

Oddly enough,

I have a test that rigs a mock to throw an exception. The target of the test
is setup to catch the exception and handle it appropriately (shows an alert
to the user). In the test, the exception is not caught by the target and it
bubbles up to the top and fails. When it is running in the simulator and
device the exception is caught -- as expected -- and the alert is shown.

It appears to be *how* exceptions are being thrown that makes a difference.

I have updated our little sandbox project to exercise this particular issue;
which I think is happening when exceptions are raised via Objective C's
NSProxy forward invocation mechanism. I created a proxy class that wraps a
real object and forwards all calls to that object -- that object throws an
exception. If the proxy class is used the exception bubbles to the top (the
test runner cannot catch it). However, if the underlying strategy class is
invoked directly (outside of forwardInvocation) the exception is caught.

OCMock *and* Hamcrest both use forwardInvocation heavily which would explain
why the test runner cannot catch the exceptions. This feels like a egregious
bug in iOS3.2 and iOS4 or they changed it on purpose and we need to find
some obscure compiler setting to bring it back.

Justin DeWind

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin DeWind  
View profile  
 More options Jul 2 2010, 10:24 am
From: Justin DeWind <dewi...@gmail.com>
Date: Fri, 2 Jul 2010 10:24:41 -0400
Local: Fri, Jul 2 2010 10:24 am
Subject: Re: Unit testing on iPhone fails

I should clarify. This does not feel like an SDK issue, but rather a
compiler issue.

Justin DeWind

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin DeWind  
View profile  
 More options Jul 2 2010, 11:05 am
From: Justin DeWind <dewi...@gmail.com>
Date: Fri, 2 Jul 2010 11:05:10 -0400
Local: Fri, Jul 2 2010 11:05 am
Subject: Re: Unit testing on iPhone fails

Sorry for pelting the group.

It does appear to be an NSInvocation issue, I ran into a red herring that
said otherwise. Exception handling does not work at all when "invoke" is
used. The only way to get around it is to use objc_msgSend.

It means these libraries have to be changed to do this.

Justin DeWind

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin DeWind  
View profile  
 More options Jul 2 2010, 11:18 am
From: Justin DeWind <dewi...@gmail.com>
Date: Fri, 2 Jul 2010 11:18:33 -0400
Local: Fri, Jul 2 2010 11:18 am
Subject: Re: Unit testing on iPhone fails

Clarification, it is both an NSInvocation and NSProxy issue.

Exceptions directly raised in NSProxy are not catchable along with invoking
NSInvocation directly.

Justin DeWind

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages < Older 
« Back to Discussions « Newer topic     Older topic »