Asia

How To Run iOS UI Tests In Parallel Using Bluepill Tool

Tudip

Tudip

01 June 2020

It’s very annoying when the test cases take a lot of time to complete the execution. Consider, you have 400+ test cases which take 5-6 hours to complete the test execution.

It will save a lot of time, if we can manage to reduce the test case execution time to 1-2 hours. We can achieve this by running the test cases in parallel using multiple simulators.

So, If you are implementing UI tests at large scale, you must need to achieve less time to complete the test run. You can improve it by using the Bluepill tool.

Introduction to Bluepill

Bluepill is a reliable iOS testing tool created by LinkedIn that runs iOS UI tests in parallel using multiple simulators.

Features 

  • Running tests in parallel by using multiple simulators.
  • Automatically packing tests into groups.
  • Generating a junit report after each test run.
  • Retrying when the Simulator hangs or crashes.

How to use Bluepill?

  1. Get the Bluepill binary
    You can get the build from the source : https://github.com/linkedin/bluepill/releases/Get binary from the (Homebrew) : $ brew install bluepill
  1. Run the tests
    Bluepill is easy to use, you just need to run the following command, and Bluepill will start running four simulators to run your tests in parallel. After the test run, it will generate a report in ./output

    ./bluepill -a ./MyApp.app -s ./MyAppTestScheme.xcscheme -o ./output/

    You can also have a configuration file as mentioned below:

    { 
    
    "app": "./MyAPP.app" 
    "scheme-path": "./MyAPPTestScheme.xcscheme" 
    "output-dir": "./build/" 
    }
    

    And run: ./bluepill -c config.json

Bluepill for fastlane support

You can also integrate the Bluepill into your project by using the fastlane plugin:

fastlane-plugin-bluepill

Fastlane Setup 

  • app : Your application path in derived data (/Products/Debug-iphonesimulator/YOUR_APP_NAME.app )
  • runner_app_path : UI test runner app path in derived data (/Products/Debug-iphonesimulator\YOUR_UITEST_SCHEME_NAME-Runner.app ).
    If there is any space in Scheme name then you have to amend it with backslash in your path.
  • scheme_path : (YOUR_PROJECT.xcodeproj/xcshareddata/xcschemes/YOUR_SCHEME.xcsche me )
  • output_dir : Bluepill reports will generate here
  • num_sims : Number of simulators to be launched.
  • runtime : The iOS version. “iOS 10.X”
  • device : eg: ‘iPhone 6s’
  • You can also use other options available for Bluepill from here: https://github.com/tbrand/fastlane-plugin-bluepill/blob/master/fastlane/Fastfile

Generate Derived Data for Bluepill 

You can generate derived date using fastlane scan:

scan(scheme: YOUR_SCHEME_NAME, 

build_for_testing: true, derived_data_path: "./bluepill", 

buildlog_path: "./bluepill/logs/" )

This will generate derived data inside the bluepill directory.

Configure the Fastfile 

lane: test do 

bluepill( 

app: 'path/to/YOUR_APP_NAME.app', 
scheme: 'path/to/YOUR_APP_NAME.xcscheme', 
output_dir: 'path/to/output_dir', 
device: 'iPhone 6s', number_of_simulators: 4, 
reuse_simulator: true ) 

end

Run the tests using fastlane: $ fastlane test

References 

 

Tudip Technologies

Tudip Technologies is a value-driven Software Services company. We deliver excellence in dedicated and business-centric web solutions incorporated with innovation and expertise as the tools to achieve business goals. Our high-quality, cost-effective, reliable, and scalable services have helped us build an enduring relationship with our clients and customers.

Latest Posts

  • All Posts
  • Casestudy
  • Cloud
  • Healthcare
  • Ios
  • IOT
  • Java
  • Manufacturing
  • News
  • OTT
  • Supply Chain
  • Support and Maintainance
    •   Back
    • Banking
Cloud-Powered Agility

December 27, 2024

27 December 2024 Introduction: Transforming Chaos into Opportunity Imagine a supply chain where disruptions are predicted before they occur, inventory…

Cloud-Powered Agility

December 24, 2024

Imagine a supply chain where disruptions are predicted before they occur, inventory is optimized in real-time, and every stakeholder works…

Related Posts

  • All Posts
  • Healthcare