-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Add capabilities to run tests with xcode-project (#54)
* WIP: add xcode-project action to list devices * Add option to filter runtimes * Finalize list devices action * Add option to specify test destinations * Fix types * Fix test_get_selected * Do not print default device info when acquiring it for test run * Extract xcode-project arguments into separate file and restructure code * WIP: xcresults parsing * Fix cli_app references * Fix type hints * Remove metaclass from RunningCliAppMixin * Skip not-implemented test * Mirror xcresult json model as Python class interface * WIP: convert xcresults to junit xml * Add parser that converts Xcresult to JUnit XML * Split xcresult collection and conversion and include more meta info in test suites * Show test results in nice format * Remove unnecessary xml * Validate runtimes for test-destinations * Improve formatting * Add tests * Generate docs for new actions * Update docstrings * Update docs * Update test arguments * Add option to test only specified tests * Add option to limit maximum concurrent test destinations * Improve test results table layout * Fix typing * Extract table into separate module * Update changelog and bump version * Add option to toggle code coverage off * Exit with error status by default in case of failed tests * Update docs * Add action 'test-summary' to show xcresult overview * Gather xcresults and simulator logs to test outputs dir * Include device info in testsuite name if present * Fix tests * Update docs
- Loading branch information
Showing
72 changed files
with
5,068 additions
and
450 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
clean | ||
===== | ||
|
||
|
||
**Clean Xcode project** | ||
### Usage | ||
```bash | ||
xcode-project clean [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v] | ||
[--project XCODE_PROJECT_PATH] | ||
[--workspace XCODE_WORKSPACE_PATH] | ||
[--target TARGET_NAME] | ||
[--config CONFIGURATION_NAME] | ||
[--scheme SCHEME_NAME] | ||
[--disable-xcpretty] | ||
[--xcpretty-options OPTIONS] | ||
``` | ||
### Optional arguments for action `clean` | ||
|
||
##### `--project=XCODE_PROJECT_PATH` | ||
|
||
|
||
Path to Xcode project (\*.xcodeproj) | ||
##### `--workspace=XCODE_WORKSPACE_PATH` | ||
|
||
|
||
Path to Xcode workspace (\*.xcworkspace) | ||
##### `--target=TARGET_NAME` | ||
|
||
|
||
Name of the Xcode Target | ||
##### `--config=CONFIGURATION_NAME` | ||
|
||
|
||
Name of the Xcode build configuration | ||
##### `--scheme=SCHEME_NAME` | ||
|
||
|
||
Name of the Xcode Scheme | ||
##### `--disable-xcpretty` | ||
|
||
|
||
Do not use XCPretty formatter to process log output | ||
##### `--xcpretty-options=OPTIONS` | ||
|
||
|
||
Command line options for xcpretty formatter. For example "--no-color" or "--simple --no-utf". Default: `--color` | ||
### Common options | ||
|
||
##### `-h, --help` | ||
|
||
|
||
show this help message and exit | ||
##### `--log-stream=stderr | stdout` | ||
|
||
|
||
Log output stream. Default `stderr` | ||
##### `--no-color` | ||
|
||
|
||
Do not use ANSI colors to format terminal output | ||
##### `--version` | ||
|
||
|
||
Show tool version and exit | ||
##### `-s, --silent` | ||
|
||
|
||
Disable log output for commands | ||
##### `-v, --verbose` | ||
|
||
|
||
Enable verbose logging for commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
default-test-destination | ||
======================== | ||
|
||
|
||
**Show default test destination for the chosen Xcode version** | ||
### Usage | ||
```bash | ||
xcode-project default-test-destination [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v] | ||
[--json] | ||
``` | ||
### Optional arguments for action `default-test-destination` | ||
|
||
##### `--json` | ||
|
||
|
||
Whether to show the resource in JSON format | ||
### Common options | ||
|
||
##### `-h, --help` | ||
|
||
|
||
show this help message and exit | ||
##### `--log-stream=stderr | stdout` | ||
|
||
|
||
Log output stream. Default `stderr` | ||
##### `--no-color` | ||
|
||
|
||
Do not use ANSI colors to format terminal output | ||
##### `--version` | ||
|
||
|
||
Show tool version and exit | ||
##### `-s, --silent` | ||
|
||
|
||
Disable log output for commands | ||
##### `-v, --verbose` | ||
|
||
|
||
Enable verbose logging for commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
junit-test-results | ||
================== | ||
|
||
|
||
**Convert Xcode Test Result Bundles (*.xcresult) to JUnit XML format** | ||
### Usage | ||
```bash | ||
xcode-project junit-test-results [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v] | ||
[-p XCRESULT_PATTERNS] | ||
[-d XCRESULT_DIRS] | ||
[-o OUTPUT_DIRECTORY] | ||
[-e OUTPUT_EXTENSION] | ||
``` | ||
### Optional arguments for action `junit-test-results` | ||
|
||
##### `-p, --xcresult=XCRESULT_PATTERNS` | ||
|
||
|
||
Path to Xcode Test result (\*.xcresult) to be be converted. Can be either a path literal, or a glob pattern to match xcresults in working directory. If no search paths are provided, look for \*.xcresults from current directory. Multiple arguments | ||
##### `-d, --dir=XCRESULT_DIRS` | ||
|
||
|
||
Directory where Xcode Test results (\*.xcresult) should be converted. If no search paths are provided, look for \*.xcresults from current directory. Multiple arguments | ||
##### `-o, --output-dir=OUTPUT_DIRECTORY` | ||
|
||
|
||
Directory where the Junit XML results will be saved. Default: `build/ios/test` | ||
##### `-e, --output-extension=OUTPUT_EXTENSION` | ||
|
||
|
||
Extension for the created Junit XML file. For example `xml` or `junit`. Default: `xml` | ||
### Common options | ||
|
||
##### `-h, --help` | ||
|
||
|
||
show this help message and exit | ||
##### `--log-stream=stderr | stdout` | ||
|
||
|
||
Log output stream. Default `stderr` | ||
##### `--no-color` | ||
|
||
|
||
Do not use ANSI colors to format terminal output | ||
##### `--version` | ||
|
||
|
||
Show tool version and exit | ||
##### `-s, --silent` | ||
|
||
|
||
Disable log output for commands | ||
##### `-v, --verbose` | ||
|
||
|
||
Enable verbose logging for commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
|
||
run-tests | ||
========= | ||
|
||
|
||
**Run unit or UI tests for given Xcode project or workspace** | ||
### Usage | ||
```bash | ||
xcode-project run-tests [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v] | ||
[--project XCODE_PROJECT_PATH] | ||
[--workspace XCODE_WORKSPACE_PATH] | ||
[--target TARGET_NAME] | ||
[--config CONFIGURATION_NAME] | ||
[--scheme SCHEME_NAME] | ||
[--clean] | ||
[--disable-coverage] | ||
[--graceful-exit] | ||
[--max-concurrent-devices MAX_CONCURRENT_DEVICES] | ||
[--max-concurrent-simulators MAX_CONCURRENT_SIMULATORS] | ||
[-d TEST_DEVICES] | ||
[--test-only TEST_ONLY] | ||
[--sdk TEST_SDK] | ||
[-o OUTPUT_DIRECTORY] | ||
[-e OUTPUT_EXTENSION] | ||
[--test-flags TEST_FLAGS] | ||
[--test-xcargs TEST_XCARGS] | ||
[--disable-xcpretty] | ||
[--xcpretty-options OPTIONS] | ||
``` | ||
### Optional arguments for action `run-tests` | ||
|
||
##### `--project=XCODE_PROJECT_PATH` | ||
|
||
|
||
Path to Xcode project (\*.xcodeproj) | ||
##### `--workspace=XCODE_WORKSPACE_PATH` | ||
|
||
|
||
Path to Xcode workspace (\*.xcworkspace) | ||
##### `--target=TARGET_NAME` | ||
|
||
|
||
Name of the Xcode Target | ||
##### `--config=CONFIGURATION_NAME` | ||
|
||
|
||
Name of the Xcode build configuration | ||
##### `--scheme=SCHEME_NAME` | ||
|
||
|
||
Name of the Xcode Scheme | ||
##### `--clean` | ||
|
||
|
||
Whether to clean the project before building it | ||
##### `--disable-coverage` | ||
|
||
|
||
Turn code coverage off when testing | ||
##### `--graceful-exit` | ||
|
||
|
||
In case of failed tests or unsuccessful test run exit the program with status code 0 | ||
##### `--max-concurrent-devices=MAX_CONCURRENT_DEVICES` | ||
|
||
|
||
The maximum number of device destinations to test on concurrently. | ||
##### `--max-concurrent-simulators=MAX_CONCURRENT_SIMULATORS` | ||
|
||
|
||
The maximum number of simulator destinations to test on concurrently. | ||
##### `-d, --device=TEST_DEVICES` | ||
|
||
|
||
Test destination description. Either a UDID value of the device, or device name and runtime combination. If runtime is not specified, the latest available runtime for given device name will be chosen. For example "iOS 14.0 iPhone SE (2nd generation)", "iPad Pro (9.7-inch)", "tvOS 14.1 Apple TV 4K (at 1080p)", "Apple TV 4K". If no devices are specified, then the default destination will be chosen (see `xcode-project default-test-destination` for more information about default destination). Multiple arguments | ||
##### `--test-only=TEST_ONLY` | ||
|
||
|
||
Limit test run to execute only specified tests, and exclude all other tests | ||
##### `--sdk=TEST_SDK` | ||
|
||
|
||
Name of the SDK that should be used for building the application for testing. Default: `iphonesimulator` | ||
##### `-o, --output-dir=OUTPUT_DIRECTORY` | ||
|
||
|
||
Directory where the Junit XML results will be saved. Default: `build/ios/test` | ||
##### `-e, --output-extension=OUTPUT_EXTENSION` | ||
|
||
|
||
Extension for the created Junit XML file. For example `xml` or `junit`. Default: `xml` | ||
##### `--test-flags=TEST_FLAGS` | ||
|
||
|
||
Pass additional command line options to xcodebuild for the test phase. For example `-derivedDataPath=$HOME/myDerivedData -quiet`. | ||
##### `--test-xcargs=TEST_XCARGS` | ||
|
||
|
||
Pass additional arguments to xcodebuild for the test phase. For example `COMPILER_INDEX_STORE_ENABLE=NO OTHER_LDFLAGS="-ObjC -lstdc++`. | ||
##### `--disable-xcpretty` | ||
|
||
|
||
Do not use XCPretty formatter to process log output | ||
##### `--xcpretty-options=OPTIONS` | ||
|
||
|
||
Command line options for xcpretty formatter. For example "--no-color" or "--simple --no-utf". Default: `--color` | ||
### Common options | ||
|
||
##### `-h, --help` | ||
|
||
|
||
show this help message and exit | ||
##### `--log-stream=stderr | stdout` | ||
|
||
|
||
Log output stream. Default `stderr` | ||
##### `--no-color` | ||
|
||
|
||
Do not use ANSI colors to format terminal output | ||
##### `--version` | ||
|
||
|
||
Show tool version and exit | ||
##### `-s, --silent` | ||
|
||
|
||
Disable log output for commands | ||
##### `-v, --verbose` | ||
|
||
|
||
Enable verbose logging for commands |
Oops, something went wrong.