Test mobile apps

Use LeanFT to create and run tests on mobile applications.

LeanFT integrates with Mobile Center, enabling you to access its mobile devices and the applications on those devices to create and run tests. For details on Mobile Center, see Mobile Center Help Center.

Overview

Using LeanFT with Mobile Center provides an end-to-end solution for automating mobile applications and integrating test automation into continuous testing processes.

This integration grants you full access to Mobile Center devices and applications. When you design tests, these devices and applications are available directly from your IDE. These same devices are used in your test runs.

LeanFT provides comprehensive Mobile APIs that you can use to automate any flow in your mobile application, whether it is native, hybrid or mobile Web application.

Use the following LeanFT tools for automating mobile applications:

  • Use the Object Identification Center to easily create robust identifications for your mobile apps and validate them.
  • Model your mobile application objects in Application models, which can be reused for testing against different devices, reducing your test creation and maintenance efforts.
  • Analyze run results using the LeanFT run report. The report includes useful information for understanding the execution flow, analyzing errors, as well as specific information on the device running the test.

Platform and application support

Using LeanFT for mobile application testing is supported for the following applications and platforms:

  • Native apps , hybrid apps, and Web apps, which run on iOS and Android devices. You can create, record, and run tests for both packaged and non-packaged applications. For details, see App packaging.
  • Create and execute tests on Windows, Linux, and Mac environments.

Back to top

Mobile APIs

LeanFT SDKs include comprehensive mobile testing APIs. These APIs are specific to mobile application testing, for example, the SDK includes APIs for gestures like swipe and shake. For details, see:

Check device vitals

LeanFT's mobile SDK includes an API for checking a device's CPU and memory usage. The information retrieved is an accumulation of the vitals from the moment the device was locked until it has been released.

Use this capability using the lock device API. For details, see .NET, Java, and JavaScript SDKs.

This enables collecting the vitals for the locked device by calling the getVitals method.

The returned value of this method, is a string in the following format:

<requestedVitalName1> <value> <timestamp>

<requestedVitalName2> <value> <timestamp>

<requestedVitalName3> <value> <timestamp>

<requestedVitalName1> <value> <timestamp>

<requestedVitalName2> <value> <timestamp>

<requestedVitalName3> <value> <timestamp>

The following is an example in C#:

{
	// lock a device and ask to collect CPU and FreeMemory
       var deviceDesc = new DeviceDescription { Name = "MyDevice" };
	var deviceSessionOpts = new DeviceSessionOptions
	{
		CollectVitals = new DeviceVitalsCollectOptions
		{
			CollectCPU = true,
			CollectFreeMemory = true,
			CollectMemory = false
		}
	};
	var device = HP.LFT.SDK.Mobile.MobileLab.LockDevice(deviceDesc, deviceSessionOpts);

	// ... do something
       // get the collected vitals
       var vitals = device.GetVitals();

	// process vitals
       var vitalLines = vitals.Split("\n\r".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
	foreach (var vitalLine in vitalLines)
	{
		var vitalLineParts = vitalLine. Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
		Console.WriteLine(String.Format("at {0}: {1} = {2}", vitalLineParts[2], vitalLineParts[0], vitalLineParts[1]));
	}
}			

View the accumulated data for the device vitals in the LeanFT run report:

  • View a graphical representation of the data collected over time in the System Monitor tab.

  • Hover over an area in the graph to see the device vitals relevant to that point in time.

Back to top

Next steps:

See also: