XCode 5 Testing symbol "rT" means what?

Deleting derived data didn't help me to get rid of running these tests. So I've created a small category on XCTestCase and it worked:

#import "XCTestCase+TestCaseSwizzling.h"
@import ObjectiveC.runtime;

static NSMutableSet* alreadyRunTests = nil;

@implementation XCTestCase (TestCaseSwizzling)

+ (void)load
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{

    alreadyRunTests = [NSMutableSet set];

    Class class = [self class];

    SEL originalSelector = @selector(invokeTest);
    SEL swizzledSelector = @selector(swizzledInvokeTest);

    Method originalMethod = class_getInstanceMethod(class, originalSelector);
    Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);

    method_exchangeImplementations(originalMethod, swizzledMethod);
});
}

- (void)swizzledInvokeTest
{
     NSString* selectorString = NSStringFromSelector(self.invocation.selector);

     if (![alreadyRunTests containsObject:selectorString])
     {
         [alreadyRunTests addObject:selectorString];
         [self swizzledInvokeTest];
     }
 }

 @end

I agree with what @everyday_productive said

"rT" usually means something wrong with indexing, to fix this go to terminal and type the following:

$ cd ~/Library/Developer/Xcode/

Make sure your Xcode is terminated then delete "Derived Data" folder.


Interesting. I have been very annoyed by the same problem with a test class I created by duplicating another file in the IDE. I have duplicated other test files before so that doesn't seem to be the problem.

The test class has only a single test inside it and another side-effect of the purple icon and classification of it as a runtime test is that you can't trigger the test with the little triangle icon offered in the test runner for the other tests or test classes.

The contextual menu in the test explorer offers Test "testBlah" which seems to exercise the test.

Quitting XCode, deleting the xcuserdata folder and rebuilding made the test recognised again as a normal test.

I am getting reminders of older Visual Studio versions which used to have caching problems and needed regular deletion of their local context data!


I found this information on some forums:

The standard way to do things in SenTestingKit/OCUnit/XCTest is to declare your tests in code. If you do, Xcode will discover them statically (ie. not at runtime) using the index. Once Xcode these tests are discovered, they show up in the test navigator with a "t" icon. So far so good.

Now, the SenTestingKit/OCUnit/XCTest frameworks also allow you to create tests on the fly at runtime. Some of our users make creative user of this capability, perhaps to wrap an external testing system or to create tests to represent a dynamic set of data. Xcode cannot discover these tests statically, and only find out about their existence when they are returning resutls during a test run. When discovered, they will show up in the test navigator with a "rT" icon. "rT" being short for "runtime discovered tests".

Finally. If there's anything wrong / unusual about your project that prevents indexing from completing or from properly parsing your test classes, then your tests wouldn't be statically discovered. You may still successfully build and run them, in which case Xcode would end up treating them as runtime discovered tests, and give them the "rT" icon.