Non-UI testing on Android | Ranorex
HomeUser GuideWeb and mobile testingNon-UI testing on Android

Non-UI Testing on Android

Next to automate testing of the user interface of mobile applications it’s also possible to perform non-UI tests invoking technology dependent actions (see Lesson 5: Ranorex Recorder – Additional Editing Options – Types of Action Items). This feature allows you to get information about the devices hardware, the operating system etc.

You are able to get the device info of your Android device directly by right-clicking the mobile device in Ranorex Spy.

Get device info of Android test device

You can access the non-UI testing methods in the action table by adding an invoke action on the mobile app.

Invoke non-UI testing methods

You can also access the non-UI testing methods within User Code Actions as well as Code Modules.

The code should look something like the following:

var app = repo.AndroidApp.Self.As(); // get an AndroidDeviceInfo object holding all available device info var info = app.GetDeviceInfo(); // get a list of SMS from the device var sms = app.GetSms(); // get a list of calls from the device var calls = app.GetCalls(); // report the manufacturer of the device Report.Info("Manufacturer: " + info.Manufacturer); // report the manufacturer of the device Report.Info("SMS: " + sms.ToString()); // report the manufacturer of the device Report.Info("Calls: " + calls.ToString());
Dim app = repo.AndroidApp.Self.[As](Of AndroidApp)() ' get an AndroidDeviceInfo object holding all available device info Dim info = app.GetDeviceInfo() ' get a list of SMS from the device Dim sms = app.GetSms() ' get a list of calls from the device Dim calls = app.GetCalls() ' report the manufacturer of the device Report.Info("Manufacturer: " & info.Manufacturer) ' report the manufacturer of the device Report.Info("SMS: " & sms.ToString()) ' report the manufacturer of the device Report.Info("Calls: " & calls.ToString())

Reference

For further information about code modules and user code actions please have a look at the chapters Code modules and Lesson 5: Ranorex Recorder – User Code Actions.