iPhone UnitTesting UITextField value and otest error 133

Posted by Justin Galzic on Stack Overflow See other posts from Stack Overflow or by Justin Galzic
Published on 2009-12-29T19:45:26Z Indexed on 2010/03/18 21:01 UTC
Read the original article Hit count: 628

Filed under:
|

Are UITextFields not meant to be part of the LogicTests and instead part of the ApplicationTest target?

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:

/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).

In the build window, this points to the following line in: "RunPlatformUnitTests.include"

RPUTIFail ${LINENO} "Test rig '${TEST_RIG}' exited abnormally with code ${TEST_RIG_RESULT} (it may have crashed)."

My unit test looks like this:

#import <SenTestingKit/SenTestingKit.h>
#import <UIKit/UIKit.h>

// 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); 
}

The class I'm trying to test:

// Header file
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@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

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c