[android] Add support for running workitems on specified Android emulator API levels#1469
[android] Add support for running workitems on specified Android emulator API levels#1469
Conversation
Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>
|
Instead of adding a new property for --api-levels , can we make --api-version work for the same propose, adding one or several ? |
|
@copilot Instead of adding a new property for --api-levels , can we make --api-version work for the same propose, adding one or several ? |
Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>
Done! The
Done! The |
This PR adds support for specifying multiple Android API levels when running tests in XHarness, addressing the need for the new Helix "multi" queue that contains pre-installed emulators covering all API levels.
Changes Made
Enhanced
--api-versionArgumentModified the existing
ApiVersionArgumentto support multiple values by extendingRepeatableArgumentinstead ofOptionalIntArgument:The argument can now be specified multiple times to test across different API levels, with the help text automatically indicating "Can be used more than once".
Emulator Management
Extended
AdbRunnerwith new emulator management capabilities:StartEmulator(int apiLevel)- Starts an emulator for a specific API levelStopEmulator(int apiLevel)- Stops an emulator for a specific API levelStopEmulators(IEnumerable<int> apiLevels)- Stops multiple emulatorsThe system automatically starts emulators for specified API levels when using multiple
--api-versionarguments, addressing the requirement that the "multi" queue does not start emulators by default.Distinguishable Results
When running tests on multiple API levels, results are stored in separate directories:
/output/api-28/for API level 28 results/output/api-29/for API level 29 resultsThis ensures results are distinguishable when the same workitem runs on multiple API levels.
Backward Compatibility
FirstApiVersionproperty toApiVersionArgumentfor backward compatibility with existing commands (android test,android install,android device) that only support single API versions--api-versionargument maintains full backward compatibility - when used once, it behaves exactly as beforeComprehensive Testing
Added unit tests covering:
Usage Examples
Fixes #1459.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.