How-tos

MobileFirst Quality Assurance (MQA) – crash capture, in-app testing, and app store analytics for iOS mobile apps – Part 1

Does anyone care if their mobile app crashes? Mobile is everywhere and unfortunately so are app crashes! Sure it’s frustrating, but even more alarming is that the reputation and health of a business can blossom or crumble on the quality of its mobile channel. As people on the go, we expect mobile apps to be:

  • Slick, quick, and easy to use
  • Have the features we need and function properly
  • Be stable, secure and elegant.

In this three-part tutorial you will see how IBM MobileFirst Quality Assurance (MQA) helps you deliver higher-quality mobile apps sooner, and detect and respond to mobile app issues faster.

  • In Part 1, you will learn how easily developers can add MQA to an existing (or new) mobile app and how easily testers can report issues. We estimate 10-15 minutes saved per bug report!
  • In Part 2, you will see how easily your development team can review and act upon those issues to make the app better.
  • In Part 3, you will see how to quickly harness public appstore feedback and act upon those issues before they become a larger social media problem.

About MQA

This tutorial revolves around IBM MobileFirst Quality Assurance (MQA), an offering designed to help businesses continually monitor and improve both the functional and subjective quality of their mobile apps. Choose how you prefer to work: MQA is available in both on-premise and cloud-hosted editions. MQA operates as a service with a web browser user interface. It comes with an SDK library or framework that can be easily integrated into a mobile app, enabling that app to send quality metrics in real time back to the MQA service.

The MQA service also routinely scans public app stores, analyzing review comments and ratings to build up an assessment of how people feel about an app. In response to certain events like crashes and bug reports coming from mobile apps, MQA can also automatically open work items in an IBM Rational Team Concert or IBM DevOps Services project. This diagram shows these relationships:

Components of the MQA service

Part 1: Let’s Get Started!

You won’t actually develop a mobile app from scratch, rather you will reuse a mobile app called BlueList that we’ve prepared for you. The source code for the app is located in a Git repository under a public IBM DevOps Services project.

  • Define a new remote repository in Xcode and point to the Git URL for this project: https://hub.jazz.net/git/leighw/Native_iOS_ToDoList (Xcode > Source Control > Check Out
  • Choose the master branch to check out. The iOS app source will be downloaded to your Mac and Xcode will open to that project.
  • Select Xcode > Product > Run. Alternatively, you can click on the Play button (triangle pointer) in the upper left of the Xcode Toolbar:
    Project Run
  • Xcode will quickly build the project and you will see a Build Succeeded notification briefly appear (and then disappear). Xcode will then launch the iOS Simulator tool automatically and it may take a few seconds for this tool to start up and run the BlueList mobile app:
    First Run Simulator
  • Play with the app. Use the plus sign (+) in the upper right of the app to add some items to the “To Do” list such as: “Buy bananas” or “Buy apples” or “Buy soup”. Try adding an item named “crash”. Did the app survive? Check the debugger, it may be stopped at the line of code that caused the problem.
    First crash
  • Now Quit the Xcode tool (command-Q key combination, or select Xcode > Quit Xcode from the main menu). If the iOS Simulator is still running, accept the suggestion to stop the running tasks when existing Xcode.

You have just loaded the BlueList native iOS mobile app project from a Git repository on IBM DevOps Services into Apple Xcode, and run it in an iOS Simulator. It’s a fine app to be sure, but it isn’t perfect. If you tried adding some sort of “crash” to its list, then you watched the app die a horrible death. Unfortunately, the project team that built the app may not know about the bug.

If only the app could tell the project team that it crashed…

MQA to the Rescue!

Next, you will download the MQA SDK library for iOS into Xcode, add the library as a dependency to the BlueList app, and edit a couple of key source files of the mobile app to integrate it with MQA.

  • Open your browser to MQA’s very helpful Knowledge Center, where you can learn lots more about the product. (HINT: bookmark this!)
  • Click Download the libraries:
  • Click iOS SDKs for download:

    KC iOS Library Link

  • Click Latest SDK for iOS to download the iOS SDK. Click the OK button of the Save dialog and the file (Q4M.framework-2.2.2.zip) will automatically be downloaded to the Downloads folder on your machine.

Note that the exact version number of the MQA SDK may be higher than 2.2.2 which was the current level at the time that this tutorial was produced. Now that you’ve downloaded the MQA SDK library, let’s add it to your project:

  • Click on the Finder icon in the Mac OS Dock to open a window displaying files and folders. Click on the Downloads folder in the Favorites list for Finder.
    Finder Downloads
  • Double click on the Q4M.framework-2.2.2.zip file shown in the Downloads folder. The Mac OS Archive Utility will automatically expand the zip file.
  • Click on the Xcode icon in the Mac OS Dock to start up Xcode again. Select the BlueList project. Click on the left most “folder” icon in the Navigator area on the left of the Xcode window. Click on the “twistie” labeled Frameworks in the Navigator area on the left hand side of Xcode so that the frameworks (libraries) used in the app are visible (if you don’t see the Navigator, select Xcode > View > Navigators > Show Project Navigator).
    expanded frameworks in Xcode
  • Drag the Q4M.framework folder from the Finder window to the Frameworks section of Xcode and drop it there so that the MQA library is added to your project. You should see a plus (+) hint near the file when it is dragged over the correct location.
    drag Q4M to Xcode annotated
  • A window will open in Xcode with options for handling the files to be added. Check the box for “Copy items if needed” and click on the Finish button.
    copy items if needed
  • Verify that the MQA SDK (Q4M.framework) is now added to the list of frameworks in your Xcode project Navigator area. If not, repeat the above step.
  • The MQA SDK has dependencies on additional common iOS frameworks, so now you will need to add those other frameworks to your project too. Click on the BlueList top level Target in the Navigator area of Xcode and then click on the General link in the Editor area in the middle of the Xcode Workspace Window. Scroll down in that editor to find the Linked Frameworks and Libraries section and click on the Add (+) button.
    linked frameworks and libraries
  • A dialog window will appear for choosing the frameworks to add to your project. Use this dialog to locate and add the following additional frameworks.
    AssetsLibrary
    AudioToolbox
    CoreLocation
    CoreMotion
    CoreTelephony
    CoreText
    QuartzCore
    Security
    SystemConfiguration
    
  • Use the Add button in the dialog box (not the Add Other…) and add each of the required frameworks. Once complete, you will see all of the frameworks in the list for the project in the Navigator area of Xcode.
    added frameworks

Add MQA code elements to your app

Normally you would add the code in this section to your app “from scratch” – in other words there would be no pre-existing MQA code in your app. For simplicity, we have already added the MQA code into the app but have commented it out. Now you will uncomment that code so that you can see the few places where your app code has to change in order to include MQA.

  • Click on the BlueList > Supporting Files twistie in the Navigator area to reveal the BlueList-Prefix.pch file. Click on that file and its contents appear in the Editor area in the middle of Xcode.
  • Notice the commented out line of code:

    // #import <Q4M-Pre-Production/MQALogger.h>.

    Replace this line of code with:

    #import <Q4M/MQALogger.h>.

    uncomment import

  • Click on the delegate twistie in the Navigator area to reveal the two source files for the main entry point of the mobile app. Click on the IBM_AppDelegate.m file to see its contents in the Editor area in the middle of the Xcode window.
    delegate uncomment
  • Replace the green “#import” line of code at the top of the IBM_AppDelegate.m file with #import <Q4M/MQALogger.h>. And then scroll down in the file (very near to the end) to locate the following commented lines of code:
    // Starts a quality assurance session using a dummy key and QA mode
    // [MQALogger startNewSessionWithApplicationKey:@"65b595fd332a8b68809363ddd381cb8221a361fc"];
    // Enables the quality assurance application crash reporting
    //   NSSetUncaughtExceptionHandler(&MQAUncaughtExceptionHandler);
  • Uncomment the second and fourth statements referencing MQALogger and NSSetUncaughtExceptionHandler.

The MQA key

Let’s take the mystery out of this 40 digit hexadecimal value MQA AppKey string.
The MQA service uses this key to identify the apps from which various sessions and reports are arriving. We used a dummy key inside IBM_AppDelegate.m but here’s how you get a key for yourself:

  • Open your web browser to the Bluemix home page.
  • Attention: If you don’t already have access to Bluemix, start your 30 day free trial by clicking the “SIGN UP” button. You’ll need this for the rest this entire tutorial.

    Note: The location of the LOG IN (or SIGN UP) button depends on the size of the browser window. In smaller windows, it is located in a drop down menu in the upper left corner of the Bluemix landing page. In larger windows, it is visible within a menu bar in the upper right area of the Bluemix landing page.

    Bluemix user

  • The first page you will see after logging in is the Bluemix dashboard, where all of the back-end applications and services for this account are visible. Bluemix is the new innovation platform, realizing DevOps by actually bringing together development and operational runtimes in a single cloud platform.
  • Bluemix home page

  • In the Bluemix dashboard, under SERVICES, select “ADD A SERVICE OR API”.
  • add a service

    Note: At this time, we’re only employing the MQA SERVICE on Bluemix and therefore are not “Creating an APP” in Bluemix. On your own, feel free to browse the app templates and create your own mobile app to which you may add the MQA SERVICE.

  • Browse the entire Bluemix catalog, as there are many pre-built and tested services you can reuse versus build from scratch! For this tutorial find and select the Mobile Qualty Assurance:
  • MQA Service

  • After reviewing the terms of the MQA service which gives you one application usage for free, make sure you leave the service “unbound” as we’re only targeting the service for this tutorial. Then select “CREATE”.
  • leave unbound

  • Bluemix gives you an arbitrary suffix to your MQA service shown on the “Getting Started Help” page. Here, simply select the blue PLUS “New MQA App” button:
  • new MQA app

  • Name your app “ToDoList” (or something else if you prefer):
  • new MQA app untitled

  • Now let’s add the iOS platform:
  • add ios platform

  • Once we add the iOS platform, you should see the following panel dashboard:
  • panel dash

  • Click the gear shaped icon at the right side of the grey iOS banner, then click Show App Key.
  • show app key

  • Voila! Copy this key into the recently uncommented line in IBM_AppDelegate.m.
  • Test that your code changes are correct by performing another build of the mobile app – either by selecting Xcode > Product > Build or by entering the command-B key combination. You should see a Build Succeeded notification briefly appear in Xcode and then fade away.

You have just edited a couple of BlueList source files in order to instrument the mobile app with MQA. First, you added the MQA SDK framework to the project, along with some additional frameworks on which MQA depends. Second, you added (uncommented) some code for the app to start an MQA session, and to send log messages to the MQA server. As you can see, instrumenting a mobile app with MQA is pretty straightforward.

Time to run the app again and see what’s different…

Test the app

Now you’ll play the role of a tester. You will run the app that you just finished instrumenting with MQA, experiment with submitting feedback and bug reports, then trip over a problem that makes the app crash.

  • From the Xcode main menu, select Xcode > Product > Run. Wait a few moments for the iOS Simulator to start.
  • After a few moments, the BlueList mobile app appears in the simulator, but you should see some activity in the app’s user interface within the simulator that is different than the last time you ran the app, including a new MQA initialization screen. These messages show that MQA is activating itself within the app, but they also provide a way for you to identify who you are when you submit feedback and bug reports.Choose tester
  • IF available, click on the your name in the MQA tester list. The MQA initialization dialog will disappear and you will see the normal BlueList starting page. If you see a dialog box saying that your app version is out of date, click on “No, thanks” to dismiss the dialog without installing a different version.
    No thanks update

Submit some feedback

Suppose you don’t like the app’s background color. Let’s submit some feedback!

  • Select the iOS Simulator > Hardware > Shake Gesture menu item
    Shake gesture
  • A view appears in the app with options to REPORT A BUG or GIVE FEEDBACK.
  • Touch (click) GIVE FEEDBACK.
    Give feedback page
  • After a moment, the Give Feedback view opens.
  • Enter some text in the Enter feedback field, such as “Please let me customize the background color.”
  • In the Star Rating area, touch (click) on one of the five stars to indicate a star rating. TIP: This is a great way to collect feedback privately that’s not visible in the public AppStore.
  • Touch (click) Send. Control returns to the BlueList app.
    Give feedback page with rating

Submit a bug

Suppose you found a bug. Let’s quickly submit a bug report!

  • Select the iOS Simulator > Hardware > Shake Gesture item from the menu.
  • A view appears with options to REPORT A BUG or GIVE FEEDBACK.
  • Touch (click) REPORT A BUG.
  • After a moment, the Report Problem view opens.
  • Enter some text in the Describe a problem here field, such as “I no longer want to do any of this.
  • In the lower left area of the view is a small screenshot of the app, labeled EDIT. Touch (click) the screenshot.
  • After a moment, the Edit a Screenshot view opens.
  • Double click on the image to hide the editor controls, and then draw (click, hold, and drag with the mouse) a circle around the item list.
  • Suppose you would prefer not to share that you apparently forgot about one of the items in the list. Double click on the Simulator to bring back the editor controls and touch (click) the button with the icon that looks like a water droplet.
  • Draw (click, hold, and drag with the mouse) over top of the “I forgot” text in the list to make it illegible.
    screenshot editor
  • Touch (click) Done in the upper right corner of the view. Control returns to the Report Problem view.
  • Touch (click) Send in the upper right corner of the view to submit the bug report. Control returns to the BlueList app.

Make it crash

Of course you can also simulate a crash and capture report information.

  • In the BlueList app, click the Add (+) button to add the item, then enter “crash” as an item and click on Save.
  • The app crashes most unpleasantly and, if you were not running an iOS Simulator connected to Xcode, you would have no indication of what happened. The app would simply disappear!
  • Stop the remnants of the crashed app by clicking on the Stop control (box) in the Xcode Toolbar (right next to the Start control).
    stop running app
  • Run the app one more time by clicking on the Start control and observing that the app continues to build and run in the iOS Simulator.
  • Quit the iOS Simulator tool and also the Xcode development tool.

To be continued…

As a tester, you’ve just had a less than ideal experience with this app. It has bugs, including a tendency to crash. There are features you wish the app had. You have just used some of the capabilities of MQA to report on these issues, a whole lot faster than gathering the information and filling out a detailed bug report. (In fact, I’ve heard horror stories of test teams who don’t report some bugs because it takes “too long” to fill out the form when they have so little time to test!)

In Part 2 of this tutorial, get ready to doff your tester hat, don your project lead hat, and experience MQA and those issues you reported from the other side of the fence…

Co-authored by Leigh Williamson

Share this post:

Share on LinkedIn

Add Comment
6 Comments

Leave a Reply

Your email address will not be published.Required fields are marked *


Roger Snook

The MQA SDK also available for Android: http://www-01.ibm.com/support/knowledgecenter/SSJML5_6.0.0/com.ibm.mqa.uau.saas.doc/topics/t_StartingAnAndroidSession.html but anyone who wants a similar tutorial for Android, please let me know!

Reply

Roger Snook

One of the most popular IBM UrbanCode plugins for Apple Xcode is here (yet more automation value!) https://developer.ibm.com/urbancode/plugin/apple-xcode/

Reply

CarlosChida

Great tutorial. Thanks a lot for sharing!

Reply

RogerSnook

For those upgrading to Xcode 7.1 and the new MQA libraries (3.2.1), I’ve had to add a few more “additional frameworks” after “SystemConfiguration” to get the app to build successfully (based on some new features):

AVFoundation
CoreMedia
AVKit
CoreData
MediaPlayer

Reply

Rohit Dhiman

Hi,
I am getting following error with MQA integration. I have done with all the mentioned steps. Please help on this.
Please check with below error. I have added all required framework.
duplicate symbol _llvm.cmdline in:
/Users/rohit/Desktop/Temp_code/ios_project/ibm_temp/Native_iOS_ToDoList/ToDoList/Q4M.framework/Q4M(APLVideoAttachment.o)
/Users/rohit/Desktop/Temp_code/ios_project/ibm_temp/Native_iOS_ToDoList/ToDoList/Q4M.framework/Q4M(ApplauseJSObjectionRuntimePropertyReflector.o)
duplicate symbol _llvm.embedded.module in:
/Users/rohit/Desktop/Temp_code/ios_project/ibm_temp/Native_iOS_ToDoList/ToDoList/Q4M.framework/Q4M(APLVideoAttachment.o)
/Users/rohit/Desktop/Temp_code/ios_project/ibm_temp/Native_iOS_ToDoList/ToDoList/Q4M.framework/Q4M(ApplauseJSObjectionRuntimePropertyReflector.o)
ld: 1092 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Reply

    Rohit Dhiman

    Hi,
    Code is working fine with XCode 7.

    Thanks,
    Rohit Dhiman

    Reply
More How-tos Stories

Reaching enterprise backend with Bluemix Secure Gateway via console

Cloud based applications often need access to backend enterprise data or services, for example, a system of records. On Bluemix, it is simplified with the Secure Gateway service where a secured tunnel can be established between a Bluemix organization and the enterprise backend network, allowing applications on Bluemix access to the backend network’s data and services. For this blog, we will set up a hypothetical company, ACME, who wants to expose some data from their System of Records (SoR) into Bluemix to enable their cloud-based applications to access it. For simplicity, in this scenario, we will expose the entire instance of a MySQL server from ACME’s backend.

Fast prototyping of native mobile apps with Fuse and Bluemix

Developed by a Norwegian startup for prototyping mobile apps, Fuse is a toolkit that developers and designers use to create native, cross-platform mobile apps for iOS and Android. This post reviews the implementation of a sample menu app for a retail company as a proof of concept app.

Bluemix and the Internet of Things

Want to take a guess as to how many devices will be connected to the internet by the end of 2015?  Give up?  15 billion.  Yup, that's right, that is 15 followed by 9 zeros.  By 2020 that number will increase to 40 billion!