Chapter 9. Mobile Testing

"The clients like our application! With the mobile app boom, we want to support a lightweight version on smartphones to boost our business and keep our users satisfied." This in fact was the target for this week's team meeting, which has surely brought with it automated testing.

Therefore, this chapter shows you how the Test Studio automation solution extends to cover mobile-device application testing by demonstrating the following feature list:

  • Deploying Test Studio components
  • Creating automated tests
  • Executing automated tests
  • Analyzing test results
  • Syncing to the web portal
  • Administering and managing the local test projects

iOS testing inside Test Studio

So you are developing this application, doing some developer testing, and running it over and over again and adding some enhancements here and there, but still do not think this is enough? Well, you are right.

  • How do you really understand the quality of what you are offering?
  • How do you ensure the same user experience irrelevant of the device?

The answer is to incorporate automation into your testing strategy!

Test Studio is not only a solution to the quality of your desktop and web applications but its iOS version also takes care of your native, web, and hybrid apps.

Test Studio for iOS also acts as a feedback tool, which keeps the developers and users involved in the same loop of continuous suggestions and enhanced releases. Hence, Test Studio provides the means by which the users can convey to the developers their experience and wish list either through integrated e-mailing mechanism or the cloud.

Unhandled errors are also an important resource for aiding developers to keep themselves aware of the application flaws uncovered during real-time usage. So, Test Studio also presents the possibility to automate the delivery of crash reports produced by the application right to the developer's inbox or web portal.

Test projects created within Test Studio can be seamlessly run against your application deployed on an iPhone, iPod touch, and/or iPad. These tests are portable and ready to be extended and executed on any of these devices wherever you are located.

Portability extends over the artifacts developed inside Test Studio, for example, the projects, test scripts, test results, and so on. This data can be either transported to another device allowing you to resume your testing from there or shared in the cloud for real-time monitoring and follow up.

The remaining of this chapter exhibits the preceding features by offering step-by-step instructions to guide you through the entire testing process ranging from the environment setup and requirement deployments, creating test projects, and syncing and monitoring in the web portal. Finally, we wrap up with the data management section, which describes how to administer the database containing the test projects and how to transfer it between devices.

Requirements

Prior to testing your iOS application, there are some requirements that should be met to be able to use Test Studio. We start with the environment requirements. Your application should be developed with the following requirements in order to successfully use Test Studio:

  • Mac OS X 10.7+
  • XCode 4.2+
  • iOS SDK 4+

Once you have met these requirements, we can then move to the testing requirements, which are summarized as follows:

  • Test Studio for iOS
  • Test Studio file bundle

The Test Studio app for iOS is going to host the test creation and execution against the application under testing. It can be directly downloaded from the App Store on any of the supported devices. It is available for free and doesn't require jailbreaking or unlocking of your mobile device. The following link has the details for downloading Test Studio from the app store:

https://itunes.apple.com/us/app/test-studio/id523796105?mt=8

As for the file bundle, it contains the following items and can be downloaded from this link: http://www.telerik.com/community/license-agreement.aspx?pId=969 using your Telerik account:

  • Test Studio Extension: This folder has the libraries that should be compiled with any application that is going to be tested with the Test Studio app.
  • Test Studio CI: It contains the tools to create coded tests for your application.
  • Test Studio Simulator: It has the scripts to deploy Test Studio to the simulator, where you can simulate the creation and execution of your tests against the application before taking things to the actual iOS device.
  • Documentation: It has the help information for using Test Studio on iOS which is also available online.
  • Demo Applications: It contains a native UIKIT-based and a web application compiled with Test Studio Extensions and is ready to be used for testing.

Deployment

For this chapter, we are going to demonstrate the features of Test Studio on an open source application called Switchy. It can be downloaded from the following link:

Switchy is a native UIKIT-based application and it provides a series of various switches that can be collectively controlled with two buttons. The Force On button will cause all the switches to toggle on whereas the Force Off button will reset them to their off state.

Deployment

Main screen of the Switchy application

UIKIT-based or hybrid applications need to be compiled with Test Studio libraries so that the application becomes visible to the recorder. So how do we compile Switchy with these libraries? Open the application with XCode and follow these steps:

  1. Using Finder, open the TestStudioExtension folder found inside the Test Studio file bundle downloaded earlier.
  2. Open the iOS folder residing there and then inside it locate the two files highlighted in the following screenshot:
    Deployment

    Test Studio extension libraries

  3. Drag the libTestStudioCommon.a and libTestStudioExtension.a items to the opened Switchy application inside XCode , as shown in the following screenshot:
    Deployment

    Adding extension libraries to the application

  4. In the resulting ensuing window, choose Create folder references for any added folders as follows:
    Deployment

    Creating references to the libraries

  5. Click on the Finish button.
  6. Select the project node inside the Project Navigator window to display the Targets section as shown in the following screenshot:
    Deployment

    Displaying application Targets

  7. Go to the Build Settings tab shown in the following screenshot and then look for the Linking section.
  8. Add this text -all_load for the Other Linker Flags option:
    Deployment

    Linking Test Studio extension libraries

  9. Go the Info tab and expand the Document Types section as shown in the following screenshot:
  10. Click on the plus button and then fill in these values:
    • Name: tstest
    • Types: com.telerik.tstest
    Deployment

    Adding document types

  11. On the same tab, expand the URL Types section.
  12. Click on the plus button and fill the various fields as follows:
    • Identifier: com.telerik.automation
    • URL Schemes: tsSwitcher
    • Role: Editor
    Deployment

    Adding URL types

After this step, the application is ready to be used with Test Studio iOS.

Simulator

XCode supports, by default, iPhone and iPad simulators. In order to use the Test Studio app on an iOS application running inside the simulator, a python script needs to be run. Hence if the following script does not run, Test Studio will not be deployed on the simulator and you will not be able to carry on the automation of your application through the simulator:

  1. Launch the terminal window on your machine.
  2. Using the cd command, browse for the TestStudioSimulator directory inside the downloaded Test Studio file bundle. For example, if the folder is saved on the desktop, type the following commands sequentially inside the terminal window:
    cd Desktop
    cd "test studio for ios"
    cd teststudiosimulator
  3. The script that we need to run is called installteststudioinsimulator.py and is present under the folder currently open in the terminal, so type the run command as follows:
    python installteststudioinsimulator.py

This will cause a script to run and eventually make the Test Studio app accessible from the simulator. Make sure that no errors are returned and the operation is successful before moving on to the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.219.130