NashTech Insights

Appium Test Results Grafana Setup Guide

Table of Contents

Graphana is an open source tool . It allows users to see their data in the dashboard in the form of charts and graphs to Grafana Setup Guide. This helps end user to analyse their report easily. Setting up a Grafana dashboard for Appium test results can be a valuable way to visualize and monitor the performance and health of your mobile app testing. Grafana is an open-source tool used for monitoring and analyzing data, while Appium is an open-source automation tool used for mobile app testing. By integrating the two, you can easily track and visualize your test results. Here’s a step-by-step guide to help you set it up Grafana Setup Guide

1: Install and configure Grafana:

  1. Download Grafana from the official website: for Grafana Setup Guide
  2. Install Grafana by running the following commands:
    wget -q -O - | sudo apt-key add -
    sudo apt update
    sudo apt install grafana
  3. Start the Grafana server:
    sudo systemctl start grafana-server
  4. Grafana server status command:
    sudo systemctl status grafana-server
  5. Enable Grafana to start on boot:
    sudo systemctl enable grafana-server
  6. Access the Grafana dashboard by opening your web browser and navigating to http://localhost:3000 (or the custom port you set during installation).
  7. Log in to Grafana using the default credentials (username: admin, password: admin). We can change the password after login.

This is how your dashboard should look like

2: Set up a data source:

  1. Click on “Configuration” then select “Data Sources.”
  2. In the Configuration menu, select “Data Sources” under the “Configuration” section.
  3. Click on “Add data source” button to add a new data source.
  4. Choose the appropriate data source type from the list of available options. Grafana supports various data sources such as Graphite, Prometheus, InfluxDB, Elasticsearch, and more.
  5. Following are the steps to install InfluxDB
    • wget qO… | sudo apt-key add –
    • source /etc/lsb-release
    • echo “deb $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/influxdb.list
    • sudo apt-get update && sudo apt-get install influxdb
    • sudo systemctl unmask influxdb.service
    • sudo systemctl start influxdb
    • influxd -config /etc/influxdb/influxdb.conf
  6. Configure the data source and add name, URL, access, and authentication settings specific to the selected data source type. The configuration options may vary depending on the data source type chosen.
  7. Test the connection to the data source by clicking on the “Save & Test” button. Grafana will attempt to connect to the data source using the provided settings and display a success or failure message.
  8. If the connection is successful, click on the “Save & Test” button again to save the data source configuration

3: Prepare the data for visualization:

  1. Make sure your Appium test results are being recorded and stored in the selected data source. If they are not already being collected, you can set up your test scripts to send results to the data source.
  2. Add influxDB java client library in pom.xml
    • <dependency>
  3. Use the InfluxDB java client to write to InfluxDB

import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBFactory;
import org.influxdb.dto.Point;
public class AppiumTestMetrics {
private static final String INFLUX_DB_URL = "http://localhost:3000";
private static final String INFLUX_DB_USERNAME = "influxdbusername";
private static final String INFLUX_DB_PASSWORD = "influxdbpassword";
private static final String INFLUX_DB_DATABASE = "nfluxdbdatabase";
public static void main(String[] args) {
String testName = "test1";
String testStatus = "pass";

Point datapoint = Point.measurement("test_results")
.tag("test_name", testName)
.addField("test_status", testStatus)
.addField("test_duration", testDuration)

4: Create a Grafana dashboard:

  1. To create a new Grafana dashboard, click on the “+” icon in the left sidebar, then select “Dashboard” -> “New.”
  2. Choose “Add Panel” and select the visualization type (e.g., graph, table, singlestat) that suits your needs.
  3. Configure the panel settings and select the appropriate data source you set up earlier.
  4. Customize the queries and visualizations according to the data you want to display. For example, you can create a graph to visualize test execution times over time or a table to display the latest test results.
  5. Continue adding more panels as needed to create a comprehensive dashboard.

5: Organize your dashboard:

  1. Arrange the panels as needed to create a well-organized dashboard layout. You can drag and drop the panels to rearrange them.
  2. Use folders to organize multiple dashboards related to different aspects of your testing, such as regression testing, performance testing, or different test environments.

6: Share and collaborate:

  1. Once you’ve set up your Grafana dashboard for Appium test results, you can share it with your team members to promote collaboration and keep everyone informed about the testing progress.
  2. Grafana provides options to create shareable links, embed the dashboard in other applications, or export it in PDF format.

That’s it! You now have a functional Grafana dashboard to visualize and monitor your Appium test results. You can further customize and refine the dashboard based on your specific requirements and needs. Remember to keep your Grafana server secure and regularly maintain it to ensure smooth performance and data accuracy.Graphana is an open source tool and can be used easily.




Always looking for new opportunities in Test Automation, CI/CD | ITIL Certified

Suggested Article

%d bloggers like this: