Code Monkey home page Code Monkey logo

Comments (10)

fpotter avatar fpotter commented on August 26, 2024

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.

drewcrawford avatar drewcrawford commented on August 26, 2024

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.

fpotter avatar fpotter commented on August 26, 2024

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.

drewcrawford avatar drewcrawford commented on August 26, 2024

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.

jasongregori avatar jasongregori commented on August 26, 2024

I was having the same issue. Updating to 0.1.2 fixed it. Thanks!

from xctool.

timor-raiman avatar timor-raiman commented on August 26, 2024

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.

timor-raiman avatar timor-raiman commented on August 26, 2024

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.

drewcrawford avatar drewcrawford commented on August 26, 2024

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.

fpotter avatar fpotter commented on August 26, 2024

@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.

timor-raiman avatar timor-raiman commented on August 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.