iOS开源 - pxctest(在多个 iOS 模拟器上并行测试)

uuahn05sq 8年前
   <h2>pxctest</h2>    <p>Execute tests in parallel on multiple iOS Simulators.</p>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/0669f1f93b97f92fef0e97b649a5a390.gif"></p>    <h2>Installation</h2>    <p>To install via Homebrew you can use theplu/homebrew-pxctest tap:</p>    <pre>  brew tap plu/pxctest  brew install pxctest</pre>    <h2>Usage</h2>    <p>Compile your tests with build-for-testing , example:</p>    <pre>  xcodebuild \    -IDEBuildLocationStyle=Custom \    -IDECustomBuildLocationType=Absolute \    -IDECustomBuildProductsPath="$PWD/build/Products" \    -scheme 'MyApp' \    -workspace 'MyApp.xcworkspace' \    -destination 'platform=iOS Simulator,name=iPhone 5,OS=10.1' \    build-for-testing</pre>    <p>In build/Products you should find a .xctestrun file. This can then be passed to pxctest :</p>    <pre>  pxctest \    run-tests \    --destination 'name=iPhone 5,os=iOS 9.3' \    --destination 'name=iPhone 5,os=iOS 10.1' \    --testrun build/Products/MyApp_iphonesimulator10.1-i386.xctestrun</pre>    <p>The --destination option can be passed in several times and will execute the tests in parallel on all Simulators.</p>    <h3>run-tests options</h3>    <p>To see a list of possible options, just run:</p>    <pre>  pxctest run-tests --help</pre>    <p>Most of the options should be self-explanatory. If not, please open an issue or submit some pull request. However the --defaults option needs a special section here.</p>    <p>run-tests --defaults</p>    <p>This option expects a path to a file, which contains some JSON. After loading this file, its content gets applied to the Simulator's defaults. On the top level the keys must be either a relative path or a domain where the defaults are located.</p>    <p>Example: You can turn off all keyboard settings that you can find in the Simulator's Settings app by using following JSON content:</p>    <pre>  {    "com.apple.Preferences": {      "KeyboardAllowPaddle": false,      "KeyboardAssistant": false,      "KeyboardAutocapitalization": false,      "KeyboardAutocorrection": false,      "KeyboardCapsLock": false,      "KeyboardCheckSpelling": false,      "KeyboardPeriodShortcut": false,      "KeyboardPrediction": false,      "KeyboardShowPredictionBar": false    }  }</pre>    <h2>Development</h2>    <pre>  git clone --recursive https://github.com/plu/pxctest.git pxctest  cd pxctest  scripts/bootstrap.sh  NSUnbufferedIO=YES xcodebuild -scheme pxctest test | xcpretty -c</pre>    <h2>FBSimulatorControl</h2>    <p>The functionality of pxctest would not be possible without the great FBSimulatorControl Framework provided byLawrence Lomax at非死book.</p>    <p>There are two command line tools that come withFBSimulatorControl:</p>    <ul>     <li>fbsimctl - command line interface to the FBSimulatorControl Framework</li>     <li>fbxctest - test runner for running iOS testing bundles for the iOS Simulator Platform</li>    </ul>    <p>Both of them are more flexible than pxctest , so it might be worth having a look at them.</p>    <p> </p>    <p> </p>    <p> </p>