Comments (10)
Hi Drew,
With xctool, you shouldn't have to pass TEST_AFTER_BUILD=1 anymore. It doesn't use any of the RunPlatformUnitTests
or RunUnitTests
scripts to start tests.
Instead you should just be able to do something like...
xctool \
-workspace YourWorkspace.xcworkspace
-scheme YourScheme \
-sdk iphonesimulator \
-configuration Debug \
-arch i386 \
build build-tests run-tests.
Let me know if this doesn't work....
from xctool.
Let me know if this doesn't work....
That's why I opened the issue :-)
Maybe a formal bug report would clear it up?
Reproduction steps
git clone [email protected]:drewcrawford/DoesThisRun.git
cd DoesThisRun
bash /path/to/xctool.sh -project DoesThisRun.xcodeproj -scheme DoesThisRun -sdk iphonesimulator build test
Expected results
Failure of test: testExample
Actual results
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
/Applications/Xcode.app/Contents/Developer/Tools/RunUnitTests:68: note: RunUnitTests exited without running tests because TEST_AFTER_BUILD was set to NO.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
run-test DoesThisRunTests.octest (iphonesimulator6.1, application-test, GC OFF)
[2013-05-02 14:56:50|Info] Installing '/Users/drew/Library/Developer/Xcode/DerivedData/DoesThisRun-ehiqteaoaxcjsdbhmticnnkibckc/Build/Products/Debug-iphonesimulator' ...
[2013-05-02 14:56:52|Info] Launching test host and running tests...
** TEST SUCCEEDED: 0 of 0 tests passed ** (3848 ms)
...
from xctool.
Thanks for the repro case!
This part looks suspicious...
[2013-05-02 14:56:50|Info] Installing '/Users/drew/Library/Developer/Xcode/DerivedData/DoesThisRun-ehiqteaoaxcjsdbhmticnnkibckc/Build/Products/Debug-iphonesimulator'
It should be installing the TEST_HOST app.
from xctool.
I think it's because I have TEST_HOST set to BUNDLE_LOADER which is set to library's .a
. It's a workaround for another problem that's documented in more detail here.
from xctool.
I was having the same issue. Updating to 0.1.2 fixed it. Thanks!
from xctool.
I'm still hitting this in 0.1.7
As in #114, this is accompanied by a crash when passing the -freshInstall option.
(the crash persists regardless of having run build-tests prior to run-tests, or using just tests).
I've also tried switching the targets in the project and in the scheme so the test target is first, thinking xctool would pick it up as the install/uninstall entity, but to no avail.
Thanks.
from xctool.
The workaround suggested by @drewcrawford works for me as well.
However, this really just a work around, since this is not the way xctool is expected to work.
In my case, after applying the workaround, I can trigger the test by forcing a build of the test target (this moves the running of the tests from the test execution phase to the test target build phase):
xctool (...) -sdk iphonesimulator build-tests RUN_UNIT_TEST_WITH_IOS_SIM=YES
from xctool.
I just wanted to go on record, since I originally opened this issue, that the vanilla "xcodebuild test" command from Apple works great after upgrading to [REDACTED]. It doesn't have all the logging bells and whistles that xctool does, but I don't really need those.
My advice is that if you actually want to test like the Xcode GUI test button does, upgrade to [REDACTED] and use the official CLI. If xctool's logging output is desired then it might be convenient to write a log parser that prints pretty colors, but I have no real plans to use xctool now.
from xctool.
@drewcrawford I went back and tried the DoesThisRun example with the latest xctool, and it worked just fine. Output: https://gist.github.com/fpotter/6419671ab22a43cb5a76
xctool definitely does support testing static library projects. In fact, this was the test case I used most often during development.
I noticed in your example output that xctool was trying to run DoesThisRunTests.octest
as an application test instead of a logic test - this isn't right. DoesThisRunTests doesn't define TEST_HOST or BUNDLE_LOADER in its build settings, which is what an application test would do. So, that's odd - I wonder if it was a bug in earlier versions of xctool that we fixed.
You mentioned setting TEST_HOST or BUNDLE_LOADER settings to the lib's .a - I do know that won't work. The TEST_HOST is an app that gets launched and that your test bundle gets loaded into. Since we can't launch or install a .a, it makes sense that this would break in xctool. In Xcode, I noticed it works without error, but I think Xcode is just intelligently skipping over it.
When I did set TEST_HOST and BUNDLE_LOADER to the .a in DoesThisRun, xctool failed exactly how you describe.
We need better error messages here.
Going to close since I think I understand the problem now. Will open a separate issue to add better error messages.
from xctool.
Confirmed.
Setting TEST_HOST to empty string through xcode target build settings ==> xctool runs tests for a static lib project.
GREAT!
from xctool.
Related Issues (20)
- The bundle extension 'app' is not supported HOT 13
- Resolve build settings for all targets simultaneosly HOT 2
- Failed to query the list of test cases in the test bundle HOT 3
- Cannot find Xcode's plist at: /Library/Developer/CommandLineTools/../Info.plist HOT 1
- Xcode 10 dropped 32-bit support HOT 1
- Xcode 10 cannot run some -appTest targets HOT 1
- New release for Xcode 10? HOT 1
- brew formula for xctool needs to be updated to 0.3.5 HOT 1
- Failures on Mojave running app host tests with `exit code 132` HOT 28
- Suite timeout not calculated correctly in all cases
- illegal hardware instruction HOT 5
- xctool run-tests --listTestsOnly only shows targets HOT 1
- xctool fails to run tests in Xcode 10.2.1 after Xcode 11 has been installed ("Invalid device state") -- need to specify "--standalone" HOT 15
- Missing absolute file ref to TestProject-Library-32And64bitTests-Info.plist
- XCode 11: Can't find library libXCTestSwiftSupport.dylib when running tests HOT 12
- fail with Xcode 11.1 An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=165): Invalid device state HOT 5
- No target application path specified via test configuration: (null) HOT 2
- Using new build system HOT 3
- Failed to find test host app for test target
- not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xctool.