How to Add Performance Metrics to Your Appium Tests
Published: 2020-09-08 16:31:41

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6w45h1eheylt0c8ob8vj.png)

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](https://bit.ly/35iRwgz) 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](https://dev-to-uploads.s3.amazonaws.com/i/2lmgy8ezvu2nl1190lqj.png)

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](https://dev-to-uploads.s3.amazonaws.com/i/t1025xj68e4zqc1zxbpt.png)

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](https://www.apptim.com/download#utm_source=apptim&utm_medium=article&utm_content=mobile-app-automation). 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](https://dev-to-uploads.s3.amazonaws.com/i/wx3xy49x8h6leq1h3ucb.png)

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](https://help.apptim.com/en/articles/4168784-publish-a-report-to-a-workspace).

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/esniajqmusn3ow56yljj.png)

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kmyjb92cvw3yb1vi5ptc.png)

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/htgf8cc50yz7zecrxfzz.png)

You can check the full report [here](https://report.apptim.com/public/ed988759-b671-11ea-917c-125c374dcc32-ec656a40-96fa-4220-9681-8606f601c913/report/report/index.html#summary_apple_iphone10-1_d20ap_mq6k2_a15bc288f0b7cb8977c35c51da3cce0fba4d6871).

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](https://blog.apptim.com/how-to-test-mobile-app-performance-3-key-ways/). 
 
Check out [this blog post](https://www.blazemeter.com/blog/mobile-performance-testing-with-BlazeMeter-and-Apptim#utm_source=apptim&utm_medium=article&utm_content=mobile-app-automation) 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!