Update 11/03/2015
@OhadSchneider's comment made me realise that KW_SPEC
worked for me because I had set it in the test configuration for my scheme (Edit scheme->Test->Arguments->Environment variables
). Setting the variable from shell doesn't work as that variable applies only to the actual build, and not when executing the unit test target.
But there's a workaround to this, by modifying the test phase of your scheme and adding a KW_SPEC
environment variable with the value $KW_SPEC
, this will expand when running xcodebuild to the value passed to the xcodebuild
command (as in my original answer). After this, xcode will will gracefully use the passed KW_SPEC
variable, xctool still has the skipped teste marked as failure issue.
Original answer
If you want KW_SPEC as an environment variable to xctool (or to any *nix tool), then you have to place it before the command, otherwise it will be considered a build setting:
KW_SPEC=NewAssessmentTests.m:12 xctool
-destination 'platform=iOS Simulator,name=iPad Retina,OS=latest'
-sdk iphonesimulator -workspace SampleProject.xcworkspace
-scheme SampleProject test
-only SampleProject_Acceptance_Tests
This will however lead to another problem: xctool
will report as errored the tests that don't run, and will report the test as failed, even if no tests have failed. xcodebuild
doesn't have this problem as it either doesn't do unit tests discovery, or ignore tests that didn't run, a thing that xctool
fails to do.
KW_SPEC
is retrieved using[[[NSProcessInfo processInfo]environment]
which means build-time settings like you used above won't work - I believe you need to set it as an environment variable in the scheme (see nshipster.com/launch-arguments-and-environment-variables) (2) The filename and line are compared against anatos
result which appears consistent with the format you used, but when I tried it myself nothing ran (0 tests executed) – Beautyhttps://github.com/kiwi-bdd/Kiwi/blob/ae9f6d83faf774754ea60a9dfc6556eb23800f47/Classes/Core/KWExampleSuiteBuilder.m
,https://github.com/kiwi-bdd/Kiwi/blob/ae9f6d83faf774754ea60a9dfc6556eb23800f47/Classes/Core/KWSymbolicator.m
. Related GitHub issue: github.com/kiwi-bdd/Kiwi/issues/614. – Beauty