Automated testing on iOS

Jacob Carlborg doob at me.com
Tue Jan 21 10:01:17 UTC 2020


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


More information about the digitalmars-d-ldc mailing list