Running all unit tests at once?

Hi,

I've got several unit tests in my project but I'm unable to run them all at once. I have to run e.g. 'TranslatorTest', then 'UtilsTest', etc.

At one moment I got AppCode to run all unit tests in one 'run', but that moment has passed.

I created a OCUnit configuration and set the class to 'All test classes'.

Any thoughts on this ? What did I do wrong ?

Thanks!

Rutger

8 comments
Comment actions Permalink

Rutger,

'All test classes' should do exactly that you want.
Just make sure thet the corresponding Run Configuration is selection and press 'Run'/'Debug'.

Does it help?

0
Comment actions Permalink

Hello Anton,

Unfortunately this doesn't seem to work.

It only runs a single test from my group folder UnitTests. Does AppCode look for all methods beginning with the name 'test' ? I've got several classes like UtilsTest and TranslatorTest in a single group called 'UnitTests'.

Schermafbeelding 2011-12-04 om 22.18.40.png
I've included a screenshot of my Run/Debug configuration. Is this correct ?

Next is a screenshot of a part of my IDE showing the unittests and result from the Run - UnitTests target:

Schermafbeelding 2011-12-04 om 22.24.22.png

Any thoughts on this ?

With regards,

Rutger

0
Comment actions Permalink

Ah, found the problem.

Due to one of my 'work-in-progress' tests, AppCode only ran that test and skipped the rest. I've commented out the test and everything works fine.

Thanks!

0
Comment actions Permalink

Ah, found the problem.

Due to one of my 'work-in-progress' tests, AppCode only ran that test and skipped the rest. I've commented out the test and everything works fine.

Thanks!

0
Comment actions Permalink

Rutger,

what do you mean by 'work-in-progrss'?
AppCode is not supposed to skip any of tests. How do we reproduce this?

Thanks

0
Comment actions Permalink

Oh sorry, I meant that it was a test I was working on. So it wasn't finished yet.

Below is the set up that only ran the specified test and skipped the other tests:

- Xcode 4.1
- AppCode 1.02
- Frameworks: OCMock 1.77, SBJson, SenTestingKit

Test:

-(void) testOnCallWebServiceShouldReturnEmptyResponse {
    // Mock the Translator so no actual network access is performed
    [self loadCannedResultWithName:@"EmptyResponse"];
    mockTranslator = [OCMockObject partialMockForObject:myTranslator];
    [[[mockTranslator stub] andCall:@selector(returnCannedResultForRequest:) onObject:self] performTranslationWithUrlString:[OCMArg any]];

    // Perform code under test
    [mockTranslator translateText:@"hond" fromLanguage:@"nl" toLanguage:@"en"];

}


As you can see, there are no assertions. The translateText methods creates a NSURLRequest and a NSURLConnection with the NSURLConnection delegate methods.

The called methods are as follows:

- (void)loadCannedResultWithName:(NSString*)cannedName {
    cannedResult = [[NSData alloc] initWithContentsOfFile:
                    [[NSBundle bundleForClass:[self class]]
                     pathForResource:cannedName ofType:@"json"]];
    STAssertNotNil(cannedResult, @"Failed to load canned result '%@'", cannedName);
}

- (void)returnCannedResultForRequest:(NSString*)request {
    // Validate request
    STAssertNotNil(request, @"Invalid request");
    NSURL *url = [NSURL URLWithString:request];
    STAssertNotNil(url, @"Failed to make request '%@' into url", request);
    STAssertEqualObjects([url scheme], @"https", @"Invalid request scheme");
    STAssertEqualObjects([url host], @"www.googleapis.com", @"Invalid request host");
    STAssertEqualObjects([url path], @"/language/translate/v2", @"Invalid request path");

    // Return canned result or error
    if(cannedResult) {
        myTranslator.responseData = [NSMutableData data];
        [myTranslator connection:nil didReceiveData:cannedResult];
        [myTranslator connectionDidFinishLoading:nil];
        myTranslator.responseData = nil;
    }
    else {
        [myTranslator connection:nil didFailWithError:cannedError];
    }
}



Next is the output from my UnitTests target:
Screen Shot 2011-12-06 at 5.08.36 PM.png

No other test than the one above is run, and it exists with exit code 139.

I've opened this project in Xcode and the behaviour is exactly the same.

I hope this helps.

0
Comment actions Permalink

Thanks, Rutger

I've create an issue based on your description. Please follow http://youtrack.jetbrains.net/issue/OC-2591 for the progress.

0
Comment actions Permalink

Rotger,

we've tried to reproduce your problem but failed to recreate your setup. Coult you please try to create a sample project and attach it to the bug report?
http://youtrack.jetbrains.com/issue/OC-2591.

0

Please sign in to leave a comment.