Resolve xcodebuild output issues (#18) Please see https://stackoverflow.com/questions/18995187/xcodebuild-corrupts-test-result-output-when-output-redirected-to-file
Resolve xcodebuild output issues (#18)
Please see https://stackoverflow.com/questions/18995187/xcodebuild-corrupts-test-result-output-when-output-redirected-to-file
xcode-test-engine is a test engine for use with Phabricator‘s arc command line tool.
arc
xcode-test-engine presently works well with projects that have a single root workspace and a single unit test target.
Supports arc unit:
arc unit
~ $ arc unit PASS 42ms★ MyTests::Test1 PASS 3ms★ MyTests::Test2 PASS 2ms★ MyTests::Test3 PASS 2ms★ MyTests::Test4 PASS 1ms★ MyTests::Test5
And arc unit --coverage:
arc unit --coverage
~ $ arc unit --coverage COVERAGE REPORT 5% src/Widget.m 18% src/SomeDirectory/AnotherWidget.m 69% src/SomeDirectory/WidgetBuilder.m 80% src/Controller/WidgetViewController.m 93% src/Controller/WidgetTableViewController.m
Add this repository as a git submodule.
git submodule init git submodule add <url for this repo>
Your .arcconfig should list xcode-test-engine in the load configuration:
.arcconfig
xcode-test-engine
load
{ "load": [ "path/to/arc-xcode-test-engine" ] }
Clone this repository to the same directory where arcanist and libphutil are globally located. Your directory structure will look like so:
arcanist
libphutil
arcanist/ libphutil/ arc-xcode-test-engine/
Your .arcconfig should list arc-xcode-test-engine in the load configuration (without a path):
arc-xcode-test-engine
{ "load": [ "arc-xcode-test-engine" ] }
Create a .arcunit file in the root of your project and add the following content:
.arcunit
{ "engines": { "xcode": { "type": "xcode-test-engine", "include": "(\\.(m|h|mm|swift)$)", "exclude": "(/Pods/)" } } }
Feel free to change the include/exclude regexes to suit your project’s needs.
Now modify your .arcconfig file by adding the following configuration:
{ "unit.xcode": { "build": { "workspace": "path/to/Workspace.xcworkspace", "scheme": "UnitTestsScheme", "configuration": "Debug", "destination": "platform=iOS Simulator,name=iPhone 6S" }, "coverage": { "product": "SomeFramework.framework/SomeFramework" } } }
Any value provided to “build” will be passed along to xcodebuild as a flag.
"unit.xcode": { "build": { ... } }
Provide the path to the product for which coverage should be calculated. If building a library/framework this might be the framework binary product.
"unit.xcode": { "coverage": { "product": " ... " } }
Some projects require a pre-build script that runs before the xcodebuild command.
"unit.xcode": { "pre-build": "execute this command before the build step" }
For example, CocoaPods projects may need to be re-generated.
"pre-build": "pod install --project-directory=path/ --no-repo-update"
We support Arcanist’s multi test engine extension. Visit the extension page to learn more about it.
Your .arcconfig file will have something similar to the following configuration:
{ "unit.engine": "MultiTestEngine", "unit.engine.multi-test.engines": [ { "engine": "XcodeUnitTestEngine", "unit.engine.xcode.config": { "build": { "workspace": "YourWorkSpace.xcworkspace", "scheme": "Scheme1", "configuration": "Debug", "destination": "platform=iOS Simulator,name=iPhone SE" }, "coverage": { "product": "SomeFramework.framework/SomeFramework" } } }, { "engine": "XcodeUnitTestEngine", "unit.engine.xcode.config": { "build": { "workspace": "YourWorkSpace.xcworkspace", "scheme": "AnotherScheme", "configuration": "Debug" } } } ] }
Coverage will appear for affected source files in Side-by-Side mode as a colored bar.
Licensed under the Apache 2.0 license. See LICENSE for details.
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
xcode-test-engine for arc
xcode-test-engine is a test engine for use with Phabricator‘s
arccommand line tool.Features
xcode-test-engine presently works well with projects that have a single root workspace and a single unit test target.
Supports
arc unit:And
arc unit --coverage:Installation
Project-specific
Add this repository as a git submodule.
Your
.arcconfigshould listxcode-test-enginein theloadconfiguration:Global
Clone this repository to the same directory where
arcanistandlibphutilare globally located. Your directory structure will look like so:Your
.arcconfigshould listarc-xcode-test-enginein theloadconfiguration (without a path):Usage
Create a
.arcunitfile in the root of your project and add the following content:Feel free to change the include/exclude regexes to suit your project’s needs.
Now modify your
.arcconfigfile by adding the following configuration:Configuration options
Build configuration options
Any value provided to “build” will be passed along to xcodebuild as a flag.
Picking the coverage product
Provide the path to the product for which coverage should be calculated. If building a library/framework this might be the framework binary product.
Pre-build commands
Some projects require a pre-build script that runs before the xcodebuild command.
For example, CocoaPods projects may need to be re-generated.
Supporting multiple test engines
We support Arcanist’s multi test engine extension. Visit the extension page to learn more about it.
Your
.arcconfigfile will have something similar to the following configuration:Viewing coverage results in Phabricator
Coverage will appear for affected source files in Side-by-Side mode as a colored bar.
License
Licensed under the Apache 2.0 license. See LICENSE for details.