NSURL to file path in test bundle with XCTest

In fact, the [NSBundle mainBundle] when running a UnitTest is not the path of your app, but is /Developer/usr/bin, so this will not work.

The way to get resources in a unit test is here: OCUnit & NSBundle

In short, use:

[[NSBundle bundleForClass:[self class]] resourcePath]

or in your case:

[[NSBundle bundleForClass:[self class]] resourceURL]

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)