OCUnit tests not running / not being found
Asked Answered
C

2

1

I'm trying to get to grips with OCTest, but can't seem to get it to actually run my tests (at least, I believe it's not running my tests). I've set up a project as described in the developer documentation, and added a class called UnitTests which contains the following function:

-(void)testFailures
{
    STFail(@"A message");
}

When I build the test bundle (in Debug or Release), the Build Results panel shows briefly that it's running the unit tests (it says something like 'Running unit tests for ... (GC OFF)'), but then shows the Build Succeeded message. The same occurs when I put less trivial tests in, such as:

- (void)testFramework
{
    NSString *string1 = @"test";
    NSString *string2 = @"testing";
    STAssertEquals(string1,
               string2,
               @"FAILURE");
}

Any ideas as to where I'm going wrong?

Corduroys answered 31/8, 2010 at 11:22 Comment(1)
One thing that tripped me up was that the unit tests only seem to run during a simulator build, not during a device build.Macadamia
P
0
  1. Setting the target for the project to ocunit?
  2. In the info for your m file, is it targeting OCUnit?
Poniard answered 28/10, 2010 at 18:28 Comment(1)
I've only just come back to this project, and your checks seemed to get it working. Thanks!Corduroys
G
0

Here is an Updated Link to the Apple Docs on unit testing.

Greco answered 19/12, 2012 at 18:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.