Menu

Mobiquity: Building Mobile Test Automation with Xcode

At Quality Jam 2017, Elise Carmichael and Corey Pyle from Mobiquity wanted to share how they tackled some of their test automation challenges utilizing the qTest Manager API library.  Mobiquity has been a QASymphony customer for more than three years and uses qTest Manager for all their testing projects which can range for testing mobile, web, and Internet of Things applications.

Check out how they built their own custom integration and learn how your team might be able to do that same thing. 

Authors: Elise Carmichael, Director of Software Engineering & Corey PyleWeb Developer at Mobiquity Inc

Why We Built This Integration

At Mobiquity, most of our projects operate using qTest Manager. Rather than having each project interact with qTest’s API directly, we created this solution easily bridge the gap between typical automation results and our qTest test case executions.

Tools Used

  • qTest Manager
  • NodeJS

Test Frameworks

XCUITest – We preferred using XCUITest over Appium since you can commit the tests in the same Xcode project file and they are backward compatibility tests.

qTest APIs

The following APIs were used for performing a custom integration of XCUITest test results with qTest Manager:

Open Source Links

Summary Integration Workflow

Write Tests

  1. Write your iOS tests with names to include the test case ID that is defined in qTest Manager.
  2. The format of the name can be defined with qTestManager with a regular expression.

Execute with xcpretty

Configure/ Run qTestManager

  • Provide Test Cycle or Test Suite location so test executions can be updated.
  • If multiple test runs exist in this location that cover the same test case, each run will be executed.

 

Details XCUITest Setup 

Install ruby gem xcpretty to convert iOS test output to xunit test results (https://github.com/supermarin/xcpretty)

  • install ruby/gems (follow instructions online)
  • `gem install xcpretty`

Install Node/npm & qTestManager (https://www.npmjs.com/package/qtestmanager-node)

  • Install node.js & npm (follow instructions online)
  • Create node project
    • npm init & name it whatever you’d like
    • Install qTestManager & save to your package.json
      • npm install --save qtestmanager-node
    • Get your access token with the auth script as exampled in the npm doc
    • Create your uploader file as exampled
      • Add regex to match how you want to name your testcases in xcode
      • Add line:
        • testNameRegex = \\D+(\d+)\;
        • Update API call function to have catch:

Execute the xctests using the ruby gem:

  • xcodebuild -project QualityJamDemo.xcodeproj -scheme AutomatedUITests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.2' test | xcpretty --report junit
    • Result goes to workspace/build/reports.junit.xml

Upload the tests to qTest Manager with the node uploader you created

  • node uploader.js (or whatever you called your node file that uses qtestmanager)

Results

Using this framework, we can gradually automate native regression tests without interfering with the integrity of our testing. Ultimately, we save time as the automated tests run regularly in lieu of manual tests. Time is freed up for the test team to focus on more creative and constructive manual tests cases including security testing and other types of testing that cannot easily be automated.

About Mobiquity

Mobiquity Inc. is a digital engagement provider that designs, builds, and optimizes data-driven solutions for more than 200 leading brands around the world. With a mission to humanize digital experiences, its team of consultants, designers, engineers, and data scientists engages consumers, patients, and employees across all channels, including mobile, web, Internet of Things, and voice, wherever they are.

Each day, 50 million users interact with Mobiquity’s solutions for accessing weather information and placing mobile orders to tracking patient trends and receiving continuous care.

Subscribe To Our Blog
Powered by Zendesk