EMEA Training 2015

UI Testing with the Testing Portal

3/2015

Testing is important!

Text

Unfortunately, there's no way you can test your cross-platform mobile app on every device your users might have.

AppBuilder to the rescue!

Create a series of test suites to run as part of your development process and run on devices in the cloud

Login to http://platform.telerik.com and click 'Create app'

Click 'Create project' to create a Hybrid mobile app project

Create a hybrid mobile project called 'TestMe' by cloning a Notification project from Github. Choose 'Clone repository' and enter 'https://github.com/Icenium/sample-notification in the URL field. Name the project 'TestMe'

Double-click the Properties link in the hybrid app's Project Navigator (right-hand panel)

Click on 'plugins' link on the left and scroll down to ensure that Mobile Testing is enabled for your app.

Right-click on the Solution (top element in the Project Navigator) to create a Mobile Testing Project

Let's take a look at this bit of code. Double-click on the MobileTestingSuite.js file to open it in the editor

We're going to see what happens when a test fails 

Click 'run' at the top to take a look at this app in a simulator of your choice

If we simply run the existing Mobile Testing suite, will it pass?

let's try!

Return to the project home by clicking its name in the top navigation, then click 'Test Portal'

Let's create a test run. Click 'Create run' 

In the dropdown, select your project (TestMe). Give your test run a description. Note the Tests included panel now shows the test suite that you included into your project with the 'Launch, Verify, Click' test that is in your test code.

Click the 'Trial Device List' row - you will be testing on three Android devices in the cloud. Click 'Submit' to start the test run. The test will be sent to three devices in the cloud.

After a few minutes, the test fails. What happened? Click the checkbox next to the test and click 'View Details'.

Drill into the test by highlighting the test name and clicking 'View Details'.

Apparently, the test has failed because the package 'you.application.identifier' was not found. Let's fix that in the test.

Go back to your mobile app project by clicking on its name in the top navigation and opening the app code. Clicking on 'Properties' in the Project Navigator pane shows that the Application Identifier of this project is 'com.telerik.samplenotification'.

Let's change the Application Identifier for our Android tests in the mobile test suite code to reference our app:

Will our test pass now? 

or

It's not going to pass, as we don't have a button with id 'submit' in our app. Let's change the test to reflect the code in our app.

Open 'index.html' in your hybrid mobile project. Note the button with the id 'alertButton'. Let's test whether that opens an alert. In MobileTestingSuite1.js, edit the test code:

 

1. change line 4 to alertBtn: {id: "alertButton"},

2. change lines 25-29 to: 

"click alert button": {
            'default': [
                web.click(queries.alertBtn)
            ]
        }

3. change line 39 to: step("click alert button");

 

Click 'save'

Go back to the Project's home by clicking its name in the top nav and return to the Test Portal. 

 

Create another test run with 3 Android devices the same way you did previously.

 

 

It passed!!

 

Drill into the details of the test and observe the screenshots of the devices on which the app was tested. For each test, the Test Portal takes a screenshot. 

 

Test your skills:

  1. Add some more devices to your device cloud and test again. 
  2. Enhance the current test by creating a new test to check whether another button can be clicked.
  3. Take a look at the documentation (http://docs.telerik.com/platform/mobile-testing/api-reference/android) for mobile testing and try to extend a test for this app by using querying or asserts

Q&A

EMEA - UI Testing

By Jen Looper

EMEA - UI Testing

  • 1,646