YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
11 stars 4 forks source link

[iOS] Support of running XCTest #5778

Open shichen85 opened 1 week ago

shichen85 commented 1 week ago

Is your feature request related to a problem?

XCTest is widely supported in test automation platforms like GitHub Actions, Firebase Test Lab, BrowserStack and CI tools like FastLane, but GameMaker's current support for it is minimal. An XCTest target (runtime-2024.400.0.571\ios\TemplateProject\${YYXCodeProjName} Tests\${YYXCodeProjName}_Tests.m) is generated but the developer cannot modify it without modifying the runtime or the transient XCode project, and it is not clear how to run the game's main gameplay loop from the XCTest target.

Describe the solution you'd like

We want the XCTest target to:

  1. Launch the main gameplay loop
  2. Provide a GML hook (such as Test Begin) to detect that the game is launched for XCTest target
  3. Provide GML hook (such as Test Complete) to define the test result for the XCTest target

This way, when developers launch the XCode project in test mode, the project will launch into the main gameplay loop, and the developer can use the Test Begin hook to put the game into testing mode and then define the test result to inform the XCTest target whether the test passed or failed. The developer will compose their tests in GML but will be able to leverage tools that supports XCTest to run the tests.

Describe alternatives you've considered

We use FireBase's game loop test for iOS testing now, but this requires the overhead of compiling and deploying the .ipa file into FireBase and parsing the run log to find out whether tests passed or failed. If XCTest is supported, tests can be run before compiling and the results of the tests are readily accessible.

Additional context

No response