DEV Community

Sofia Palamarchuk
Sofia Palamarchuk

Posted on

How to Add Performance Metrics to Your Appium Tests

In this post, I will show how you can get mobile performance data using Apptim while running Appium automated functional tests.

Alt Text

For anyone involved in the development of a mobile app, being able to test it thoroughly and even automate some of the process is a huge relief and time saver. This is where mobile app automation becomes important.

There are many ways that testers and developers can find out about bugs and potential issues in their app. Apptim is a mobile performance testing tool that can be used during manual app testing, exploratory testing, and debugging. And lately, many Apptim users have been wondering if there’s a way to use it along with their automated tests.

The answer is, yes!

Appium is an open source tool that enables you to write automated UI tests for Android and iOS apps. In order to use Appium, you will need to install the Appium server and create some tests for your app.

In this post, I will show you how you can use both tools together for more complete mobile app testing in just three simple steps:

1- Run Appium Java tests on an iOS app

2- Install Apptim and run a test

3- Review the Apptim report

Example of How to Use Apptim with Appium

1- Run Appium Java tests on an iOS app

For this example, we will be using IntelliJ to write and run our tests in Java. We created a class called DemoApptimTest, where we set up our desired capabilities.

Alt Text

We then created three tests for our iOS retail app: filter a category, select a product and add a product to cart. We’ll use Java to write our tests and TestNG as the test runner.

Example of a test to filter products by category, “Phone”:

Alt Text

We can debug and run the Appium tests from inside IntelliJ.

2- Install Apptim and run a test

We then download the Apptim Mac desktop application from here. Apptim requires installing some dependencies, which it will list for you, and after clicking “Install Dependencies,” it will begin to install them for you if they are not installed already.

We already have our retail app installed in an iPhone. To start a test, we will simply connect the device to our Mac through a USB cable and open Apptim.

Then, Apptim will ask what type of test we’d like to run. In this example, we will be running our Appium tests and we want Apptim to capture the app performance data. So, we’ll choose the exploratory tests option when prompted, and put a name to our test.

Alt Text

Apptim will start recording everything that happens in the app. We now go back to our IntelliJ IDE and click on “Run” to run the Appium tests. Make sure you have the Appium server running before starting the tests. At this point, the automated tests will exercise the app and Apptim will record everything and generate a report at the end.

Once the Appium tests are done, we click on “End Session” in Apptim and wait for the test session report (which will be generated automatically).

3- Review the Apptim report

Once we’ve finished our test session, Apptim will generate a report with a summary of all of the performance data that it has automatically captured for us while the Appium tests were running. We can open this report locally or publish it to our Apptim cloud workspace.

Alt Text

Here are some screenshots that the Apptim Report generated for our retail app:

Alt Text

And here we can see how the memory usage was increasing over time:

Alt Text

You can check the full report here.

With just a click of a button, Apptim captured a lot of insights for us!

More Resources

To learn more about the different mobile performance metrics that Apptim covers in its reports, check out this article.

Check out this blog post where I cover how to run automated tests with Apptim using the open source tool, Taurus.

Get More Out of Mobile App Automation

These days, mobile performance is more crucial than ever, but it’s also a challenge to gain visibility into all of the factors that impact it.

Apptim provides easy-to-read reports to check mobile app performance, review logs, and crash details while going about your manual or automated functional tests. Teams can now release new versions of their app with confidence by getting full visibility on app performance trend with minimal effort.

I hope you found this article useful and feel better prepared to add a performance test to our current mobile app automation efforts!

Oldest comments (0)