jeudi 1 janvier 2015

Xcode unit test fail correctly but doesn't using xctool

I'm trying to experiment unit test for the first time using xctool and Xcode.


So I simply added these instructions in my testFunction :



let name = "Aymen" as NSString
XCTAssertTrue(name.containsString("men"), "Aymen name should contain men string")


containsString is a method added in iOS 8. So sure, when compiling with Xcode on iOS 8 it works, but iOS 7 it crash telling me unrecognized selector, which is normal.


But when I'm trying to launch the test using xctool, it doesn't show me any errors, the test doesn't fail



[Info] Collecting info for testables... (1956 ms)
run-test EmptyAppTests.xctest (iphonesimulator7.1, iPhone 5s, application-test)
[Info] Installed 'aymenworks.EmptyApp'. (618 ms)
[Info] Launching test host and running tests ... (0 ms)
✓ -[AuthenticationTests testGetRequest] (407 ms)
✓ -[AuthenticationTests testNewOsMethod] (0 ms)


This is the command line I use :



xctool test -test-sdk iphonesimulator7.1 -destination "platform=iOS Simulator,name=iPhone 5s" -workspace EmptyApp.xcworkspace -scheme EmptyApp


Thanks you in advance to guide me.


Aucun commentaire:

Enregistrer un commentaire