Local executions with Insights data & Page performance summary metric data
Overview
Local executions refer to running automated tests or scripts directly on your local machine rather than on remote servers or cloud-based platforms. This approach typically involves setting up the necessary tools, environments, and dependencies on your computer to execute the tests.
Prerequisites
- TestGrid login credentials
-
Java Development Kit (JDK): Install the latest version of JDK on your machine. Appium is compatible with JDK 8 or later versions.
-
Integrated Development Environment (IDE): Choose an IDE to write and execute your Java Appium code. Popular choices include IntelliJ IDEA, Eclipse, or NetBeans. Make sure your IDE is properly installed and configured.
-
Appium Java Client: Add the Appium Java Client dependency to your Java project. Using a build automation tool like Maven or Gradle, you can include the dependency. The Appium Java Client allows you to interact with the Appium server using Java code.
-
There are client libraries in Java that support Appium’s WebDriver protocol extensions. You should use these client libraries instead of your regular WebDriver client when using Appium.
Step 1: Log in to the TestGrid portal using valid credentials.
- Click on the Selenium or Appium option to generate the desired capabilities for local execution. After generating the capabilities, you can use them in your local code.
- If you want to have page performance summary metric data and insights in your local execution result, you need to integrate the following line of code:
// Java Syntax
Add this at the start of your test case
((JavascriptExecutor) driver).executeScript(“tg:logs”, ImmutableMap.of(“pageLoadStart”, teststep));
Add this after each step
((JavascriptExecutor) driver).executeScript(“tg:logs”, ImmutableMap.of(“pageLoadEnd”, testStep));
For Example:
((JavascriptExecutor)driver).executeScript("tg:logs", ImmutableMap.of("pageLoadStart", "Urldemo1")); Thread.sleep(3000); driver.get(Urldemo); System.out.println("Redirected to " + Urldemo + " successfully."); ((JavascriptExecutor) driver).executeScript("tg:logs", ImmutableMap.of("pageLoadEnd", "Urldemo1"));
After adding the two lines of code to your local code, you will see the results in the automation section under the test results.
Step 2: Automation session:
- After clicking on the automation option, select the device or project on which you have executed your local execution.
- Once you click on the project, you will see the page performance summary page.
- After clicking on the page-wise data, you will see all the information about test cases. [ i.e. start time, end time, test case name, status, DeviceName]
- On the Page Summary screen, located on the right-hand side, you will find the Settings option. Here, you can customize the ranges for Good, Average, and Slow performance values. Ensure that you enter appropriate and acceptable values.
- We have a dropdown option next to the Settings option that allows you to view the page summary data for the previous month, current month, current week, and previous week.
Step 3: Local execution dashboard
- After selecting your project from the left-side panel, click on the Performance Data option to view detailed analytics. This section offers insights into performance metrics, allowing you to evaluate and optimize your performance summary data effectively.
- Click on the insights options you will get The Insight Data section provides a comprehensive overview of your website’s user behavior and trends. It analyzes collected data to offer actionable insights, helping you identify patterns, optimize performance, and make data-driven decisions to improve the overall user experience
Happy Testing!!!