How to Integrate LambdaTest with Calliope.pro?

Ramit Dhamija

Posted On: September 12, 2019

view count17872 Views

Read time9 Min Read

Collaboration is pivotal for any successful release. Can you imagine going through a sprint without consulting or informing any other team involved in the project about what you did? You can’t right because it is not a pretty picture. Modern SDLCs demand various teams to coordinate as they try to deliver a product as quickly as possible in the market, with assured quality.

Your job as an automation tester doesn’t end up by merely running automation scripts for your web application, you also have to share the test results across different teams such as the development team, or business analysts. Generating and presenting reports requires a lot of effort as your reports need to clearly indicate which modules are working fine and which ones are failing.

This week I added a new tool in my testing checklist to help me share across the results of my Selenium automation testing across my team as I performed automated cross browser testing, and the tool is Calliope. In this article, I am going to help you integrate your LambdaTest account with Calliope, so you could share reports of test automation scripts executed at LambdaTest Selenium Grid across your teammates in a jiffy. Let’s start with the big question.

What Is Calliope?

Calliope

Calliope is cloud-based tool providing you with a collective dashboard for sharing, and monitoring, and comparing the results of your automation script execution. Offering compatibility with major test automation frameworks, Calliope enables your organization to have a unified view of everything that is going around with your automation test scripts. Your stakeholders can analyze it too for comparing the current state of your test cycles with a historic state.

Calliope ensures that your entire team is on the same page when it comes to analyzing your test results. Here is how:

  1. Sharing your test results – Your test results are presented in Gherkin syntax, making it easier to understand by your stockholders as well.
  2. Customize your own dashboard – Invite your colleagues and structure the dashboard in a manner as you structure your team.
  3. Compare Historical Data – You can compare the current health status of your test builds with historical status. Plus, all your test cases are gathered in a single region allowing even your non-technical stakeholders with a clear picture of the overall health for your automation scripts.
  4. Easy Regression Check – Calliope stores all your test imports on their clouds making it easier for you to reflect back anytime for validating your regression test cycles.
  5. API integration – Calliope API will help you run your test suites on third-party tools instantly through the test results dashboard presented in your Calliope instance.
  6. CI/CD Integration with GitLab – Like LambdaTest, Calliope also offers integration with GitLab CI to help you import your test cases directly from your CI/CD pipeline to Calliope instance.

Now, that we have an idea about the various features offered by Calliope. It is about time we get to know about integrating LambdaTest with Calliope. However, to those of us who are not aware of LambdaTest.

What Is LambdaTest?

We offer a cloud-based cross browser testing platform to help you perform browser compatibility testing by both manual and Selenium. LambdaTest offers a Selenium Grid of 3000+ real browsers for both mobile and desktop, running on real operating systems. Here is a quick video tutorial about us:

Perform Cross Browser Testing with LambdaTest on 3000+ Browsers With A Free Sign-up.

Why Should You Integrate LambdaTest With Calliope?

If not well-orchestrated, cross browser testing can turn out to be a mess. You will require a thorough plan and strategy, design a cross browser compatibility matrix to figure out which browsers are of higher priority and which ones are of the lowest. Depending on the amount of test coverage, and time in-hand, you will need to make a decision to opt for automated cross browser testing. To pace things even faster you would require parallel execution with Selenium, by which you can run multiple test cases simultaneously. And even after following up the right plan, you would need a testing dashboard where you can club all of your test cases in one place, for everyone to have a clear and concise view. This is where LambdaTest integration with Calliope comes into the picture.

Using LambdaTest integration with Calliope you can analyze the test results of automation test scripts being executed in parallel on more than 3000 browsers + OS combinations. Let’s get started.

Import LambdaTest Automation Test Results Into Calliope Dashboard

So, now you are aware of LambdaTest and Calliope’s services, let’s have a look at how you can import your LambdaTest automation test results directly to Calliope dashboard.
For fetching LambdaTest automation test results details from scratch we need to call LambdaTest API which provides us our recently executed test session details such as name, status, os, browser, version and all generated logs endpoint. We will be making use of the below API:
Get/sessions/{session_id}

It will provide us with information specific to our test sessions. This would require you to give the session ID for the test session you want to retrieve the details for. You can refer to LambdaTest API Documentation to check the example value or schema.

Below is the test session details that would be fetched through LambdaTest API and will get imported to Calliope dashboard.

You might be wondering how you can send the above test session details directly to Calliope dashboard after retrieving from LambdaTest API. So, here is the Java-TestNG code for you that can help you setting up the test environment which further includes your username, accesskey, gridURL and test configurations such as browser, browser version, OS etc.

Once you have set the test environment, you can now write your test cases. We have been using SessionId Java class that provides the session ID for running session, we can use the same session ID for calling LambdaTest GET Session API whose URL is:
https://api.lambdatest.com/automation/api/v1/sessions/

For accessing the LambdaTest API, you need to get authorized with your credentials that include your username and access key. We have used Base64 class to encode the credentials which are universally accepted format by web servers and browsers.
Now, we can use our encoded basic authorization with session URL to send the GET request for the test session details.

Since, we are using Java-TestNG here, all our test results and logs get saved in testng-results.xml file. The purpose of this file is to capture the test session data and can further be used with Calliope API in order to transfer the saved test session data to Calliope Dashboard. In the below code, we have also used Reporter.log which would report the test logs and all other session details to the testng-results.xml file.

Check out our GitHub repository for accessing the entire code represented in this article to integrate LambdaTest with Calliope.

Now, after executing the above code, we have our test executed on LambdaTest Selenium Grid along with the test testng-results.xml file saved in our system which includes all our recent test session details.

 LambdaTest Automation Dashboard

LambdaTest Automation Dashboard

The next step is to call Calliope API to post the test data from testng-results.xml file to Calliope dashboard. Calliope support different result file format according to different frameworks. For instance, XML for Junit and TestNG, JSON for Cucumber. For more information on this, you can refer to Calliope’s documentation link.

We have used MediaType class to define the file type(XML) for our TestNG framework. Now, we need a testng-results.xml file to GET and POST test session data. So, we need to define the directory where this file is saved to access the file by calling the Calliope API.
We have defined API command as an endpoint URL which includes your profile number along with OS, platform and build name. You can extract your Calliope API from their documentation for API import.

Make sure you have entered the correct API Key, otherwise, your test would fail due to unmatch of API Key with your profile number.

After setting up the endpoint URL and the API Key, it’s time to call Calliope API now by sending a POST request for importing test results to the dashboard.

Console Output

Console Output

To make sure that CalliopeAPI.java file is getting executed after BaseTest.java file finishes its execution, we have used TestNG Listeners for this. Just for the recap, the BaseTest.java file includes the test configurations, test cases and the procedure for calling the LambdaTest GET session API. So, unless the execution of BaseTest.java doesn’t end up we cannot call CalliopeAPI.java, this is the reason that we have used IExecutionListener which provides two methods and onExecutionFinish().

  • Method onExecutionStart() gets invoked before TestNG run starts.
  • Method onExecutionFinish() gets invoked when all the suites have been run.

Since we are retrieving data from LambdaTest API whose schema is in JSON format, so we need to set up and organize the test session retrieving data using JsonPropertyOrder.

Below is the code which would show you the hierarchy or list in which the test session data would get organized.

In SessionData.java only session data variables are declared, though they are defined in a hierarchical manner but they do not contain any values yet. We have now created a new class SessionResponse.java that would set values to the previously defined session data variables.SessionResponse.java class has been called by BaseTest.java class for setting the values for session data variables after retrieving from LambdaTest GET session API.

Now, if you look at the Calliope dashboard you will be able to notice a screenshot below, representing the executions of your automation test script at LambdaTest Selenium Grid for automated cross browser testing.

Calliope Dashboard

Calliope Dashboard

How Was That?

Kudos! You have successfully imported your automation test results of the Selenium Grid offered by LambdaTest on your Calliope dashboard. Now, you can effortlessly collaborate your teammates while performing cross browser testing with LambdaTest. Let me know your thoughts on this integration and how it helped to fast track your test cycles. Stay tuned for more articles by hitting the notification bell at the bottom. Cheers and happy testing! 🙂

Author Profile Author Profile Author Profile

Author’s Profile

Ramit Dhamija

Working as an Automation Expert at LambdaTest and has recently started the professional journey. Excels in Java test automation.

Blogs: 10



linkedintwitter

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free