Support command-line arguments and XCTest filters without forcing xcodebuild in ios_xctestrun_runner

Aperta
#3,129 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva

Direzione di ricerca

Start by locating ios_xctestrun_runner and comparing the direct xctest and xcodebuild test-without-building branches. Check how command_line_args and test filters are parsed, then find the runner tests that cover backend selection. Done means representable arguments and XCTest selections use direct execution while cases it cannot handle still select xcodebuild; add or update tests for both paths.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Allow hostless iOS simulator XCTest bundles to continue using direct xctest execution when supplying command-line arguments or test selections that xctest can handle.

Currently, ios_xctestrun_runner switches to xcodebuild test-without-building whenever command_line_args or a test filter is supplied. The direct execution branch always invokes:

xcrun simctl spawn <simulator-udid> <xctest-binary> \
  -XCTest All <test-bundle>

However, direct xctest execution supports useful arguments and test selection, so these inputs do not always require switching execution backends.

Use cases

1. Language, locale, and text-direction overrides

-AppleLanguages '(en_GB)' -AppleLocale en_US -AppleTextDirection NO

Apple documents these launch arguments in Testing Your Internationalized App, alongside arguments for testing right-to-left layouts, double-length localized strings, and detecting non-localized strings.

Passing preferences per invocation avoids changing persistent simulator preferences.

2. Custom test configuration

Test code or its dependencies may read startup arguments through CommandLine.arguments, ProcessInfo, or argument-domain preferences-for example, to select fixtures or enable test-specific behavior.

3. Running selected XCTest classes or methods

The documented xctest -XCTest option supports class and method identifiers, including comma-separated selections. Running one test, one class, or several selected tests should be able to retain direct execution where the selection is representable.

These cases are particularly useful for short hostless test bundles, where switching to xcodebuild introduces additional startup and orchestration work.

Example

Given an otherwise directly executable hostless XCTest target:

bazel test //tests:ExampleTests \
  --test_arg="--command_line_args=-AppleLanguages,(en_GB),-AppleLocale,en_US"

Or:

bazel test //tests:ExampleTests \
  --test_filter=ExampleTests/testExample

Both currently select xcodebuild, even when no other requested feature requires it.

Lingua principale
Starlark
Stelle
600
Fork
354
Merge medio
2g 7h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bazelbuild/rules_apple

Tutte le issue di bazelbuild/rules_apple

Issue simili

Altre issue su Build System

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.