Automated testing on iOS

Dan Olson gorox at comcast.net
Sat Feb 8 19:54:41 UTC 2020


Jacob Carlborg <doob at me.com> writes:

> So far I've been testing on iOS by using a Xcode skeleton
> project. Since Xcode cannot build D code I've been building the D code
> outside of Xcode and inserted the binary into the Xcode project. Then
> I run the binary on the device through Xcode.
>
> This is not really a good approach for automated testing and CI
> pipelines. There's a command line tool for building Xcode projects,
> which will help with automation. The problem is that this tool doesn't
> allow to run a project. What seems to be the only way to run code on a
> device using the command line is to run a test. To run a test it seems
> that one needs to use the XCTest framework that comes with Xcode.
>
> I'm thinking that easiest way to do this is to generate/have a Xcode
> project with a single XCTest test implemented in Objective-C which
> initializes druntime and calls [1] (for druntime) to run the tests.
>
> But I'm not sure how to best integrate this with the existing
> build/test infrastructure. I'm not sure if the project needs to be
> generated or if it's static enough to be committed to the
> repository. If needs to be generated if would be nice if
> `ldc-build-runtime --testrunners` generated it.
>
> Or perhaps this is possible to do with CMake?
>
> [1]
> https://github.com/dlang/druntime/blob/ec1b76acb68d460eaa66103b6cc7774f231c2d7f/src/test_runner.d#L11
>
> --
> /Jacob Carlborg

Hi Jacob, nice progress on getting iOS support into ldc!  I peek at the
forums every now and then. Your approach of using an xcode test was how
I ran from the command line on an iOS device.  The idea to generate an
Xcode project with test seems good to me.

I assume you know about setupEnvAndRunTests() in

https://github.com/smolt/ldc-iphone-dev/blob/master/unittester/unittest.d

Is that still needed to pass all druntime/phobos unittests?
-- 
Dan


More information about the digitalmars-d-ldc mailing list