mercredi 8 juillet 2015

xctool can’t seem to see Google Tests

I am unit testing an iOS framework (i.e. not an app) - so I don’t think any of the usual “Bundle Loader” and “Test Host” applies. But I could be wrong - I had lots of “fun” resolving this separate test bundle given it’s not loaded into an App, in order to load resource files...

Anyway, that aside, everything is now set up to build in XCode and it all works - thanks mainly to this excellent bit of glue: http://ift.tt/1RkfGv1

MyFramework.framework is it’s own target (and shared scheme), with associated MyTests for the “Test” step.

If I choose the “Test” (Cmd-U) command from the Product menu, it will build and test (with integrated test output) just fine.

I can also do the same from the command line with:

 > xcodebuild test -project MyFramework.xcodeproj -scheme MyFramework -destination 'platform=iOS Simulator,name=iPhone 6' -configuration Release

And I can see the tests output at the end:

Test Suite 'All tests' started at 2015-07-08 10:59:02 +0000
Test Suite ’MyTests.xctest' started at 2015-07-08 10:59:02 +0000
Test Suite 'test_this_suite' started at 2015-07-08 10:59:02 +0000
Test Case '-[test_this_case]' started.
Test Case '-[test_this_case]' passed (0.345 seconds).
Test Suite 'test_this_suite' passed at 2015-07-08 10:59:02 +0000.
 Executed 1 test, with 0 failures (0 unexpected) in 0.345 (0.348) seconds
...

Now, using xctool I can build it fine as well:

> xctool build -project MyFramework.xcodeproj -scheme MyFramework -destination 'platform=iOS Simulator,name=iPhone 6' -configuration Release

But, trying to get it to run the tests fails. It can’t seem to find anything to run.

> xctool run-tests -project MyFramework.xcodeproj -scheme MyFramework -sdk iphonesimulator -configuration Release

[Info] Loading settings for scheme ‘MyFramework' ... (880 ms)

=== RUN-TESTS ===

 [Info] Collecting info for testables... (1631 ms)
run-test MyTests.xctest (iphonesimulator8.4, logic-test)
--
skipping: This test bundle contained no tests.
--

** RUN-TESTS SUCCEEDED: 0 passed, 0 failed, 0 errored, 0 total ** (1632 ms)

I then though, ah! Perhaps these are also meant to be specified explicitly as "logic tests” (since they don’t test any in-app functionality) so let me try:

> xctool run-tests -logicTest Release-iphonesimulator/MyTests.xctest -sdk iphonesimulator

Didn’t work either. Same error.

(BTW. it seems you have to have the -logicTest option immediately after “run-tests”).

So, can anyone see what am I doing wrong here? Appreciate it.

Aucun commentaire:

Enregistrer un commentaire