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 Detailed list of actions). This feature allows you to get information about the device's hardware, operating system, etc.
Non-UI testing on Android
You can get the device info of your Android device directly by right-clicking the mobile device in Ranorex Spy.
You can access the non-UI testing methods in the action table by adding an invoke action on the mobile app.
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:
C#
var app = repo.AndroidApp.Self.As<AndroidApp>();
// 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());
VB.NET
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())
For further information about code modules and user code actions please have a look at the chapters Code modules and User code actions.