Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone UnitTesting UITextField value and otest error 133
    text
    copied!<p>Are UITextFields not meant to be part of the LogicTests and instead part of the ApplicationTest target?</p> <p>I have a factory class that is responsible for creating and returning an (iPhone) UITextField and I'm trying to unit test it. It is part of my Logic Test target and when I try to build and run the tests, I get a build error about:</p> <blockquote> <p>/Developer/Tools/RunPlatformUnitTests.include:451:0 Test rig '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/ 'Developer/usr/bin/otest' exited abnormally with code 133 (it may have crashed).</p> </blockquote> <p>In the build window, this points to the following line in: "RunPlatformUnitTests.include"</p> <pre><code>RPUTIFail ${LINENO} "Test rig '${TEST_RIG}' exited abnormally with code ${TEST_RIG_RESULT} (it may have crashed)." </code></pre> <p>My unit test looks like this:</p> <pre><code>#import &lt;SenTestingKit/SenTestingKit.h&gt; #import &lt;UIKit/UIKit.h&gt; // Test-subject headers. #import "TextFieldFactory.h" @interface TextFieldFactoryTests : SenTestCase { } @end @implementation TextFieldFactoryTests #pragma mark Test Setup/teardown - (void) setUp { NSLog(@"%@ setUp", self.name); } - (void) tearDown { NSLog(@"%@ tearDown", self.name); } #pragma mark Tests - (void) testUITextField_NotASecureField { NSLog(@"%@ start", self.name); UITextField *textField = [TextFieldFactory createTextField:YES]; NSLog(@"%@ end", self.name); } </code></pre> <p>The class I'm trying to test:</p> <pre><code>// Header file #import &lt;Foundation/Foundation.h&gt; #import &lt;UIKit/UIKit.h&gt; @interface TextFieldFactory : NSObject { } +(UITextField *)createTextField:(BOOL)isSecureField; @end // Implementation file #import "TextFieldFactory.h" @implementation TextFieldFactory +(UITextField *)createTextField:(BOOL)isSecureField { // x,y,z,w are constants declared else where UITextField *textField = [[[UITextField alloc] initWithFrame:CGRectMake(x, y, z, w)] autorelease]; // some initialization code return textField; } @end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload