bazelbuild / bazelbuild/rules_apple
Support generating `ios_uitests` without a `test_host`
- Dominant language
- Starlark
- Stars
- 593
- Forks
- 334
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 9
Description
**Background**
Currently, we have a TestBundle created through `ios_uitest` which hosts our core user flow performance tests (e.g. performance test a page load, startup times, etc.). The current workflow is that whenever a change is made to the app, the TestBundle must also be recreated as the TestBundle hosts both the tests and the app itself (as defined by `test_host`).
For an app of our size, re-running performance tests ends up being extremely slow as we need to re-build the TestBundle every time (~1 minute) plus re-install the app (~2 minutes) just to run a performance test.
The ideal workflow, which would emulate how performance testing is done on Android with UI Automator, is that we'd ideally have an isolated TestBundle that only contains the performance tests themselves. Then the test itself hardcodes which bundle identifier to target or takes it in as a parameter. This can be done by instantiating `XCUIApplication` which a custom `bundleIdentifier`.
**Feature Request**
Presently, it is not possible to use `ios_ui_test` rule without `test_host` being set. Looking through the code for that rule it appears that there'd be some work required in how the `xctestrun` template is generating and some associated steps for that rule.
**Workaround**
In the interim, I was able to achieve what I want here by creating effectively a no-op app `ios_application` target with that just renders an empty view and specifying that as the `test_host`, then using the approach mentioned above of constructing `XCUIApplication` instances with an arbitrary bundle identifier.
Embedding a no-op app doesn't add that much additional overhead so this workaround is reasonable for the time being.
Contributor guide
Research direction
Start with the ios_ui_test rule and the xctestrun template generation described in the issue, then trace the associated rule steps for how test_host is required. The work is complete when an ios_ui_test can omit test_host while producing a usable isolated test bundle, with coverage for that configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios
- Domain
- mobile, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100