Do you have feedback on our new interface?
Do you have feedback on our new interface? Let us know HERE

SiteScope REST APIs – Automate using Karate

Kanika Frequent Contributor.
Frequent Contributor.
0 0 2,035

If you are reading this blog then most likely you are either exploring new ways of automating the SiteScope REST APIs or you are looking at enhancing the existing automation. If you are charged with building and supporting APIs in your group, you will be required to monitor these APIs at all times to ensure that there is continuous testing of these APIs during and after development. Additionally, the consumers of your APIs are most likely going to attempt to use it in different ways. Therefore, it is all the more important for you to include these as test cases and automate the API monitoring.

SiteScope REST APIs can be easily automated using the latest open source tool Karate developed by Intuit. It overcomes the short comings of the existing automation tools like Cucumber or Rest Assured and takes away the overhead of writing huge lines of code before you can start testing it.

This blog explains how to use Karate for automating any REST API call exposed by SiteScope.

Karate API Test Tool Setup

1. Set up Karate REST Test Project. Use the instructions documented in this blog: https://www.joecolantonio.com/2017/03/23/rest-test-tool-karate-api-testing/

2 . Use the basic-auth.js to configure the authentication for REST API. Following is an example of code snippet that I used.

1.jpg

3.  Set up the configuration properties as required. karate-config.js file is the default configuration file that  can be used for configuring the properties.  Take a look at the code snippet that I used.

4.  Write the feature file that includes all your test cases and scenarios.  See the SiteScope API Reference Guide for parameters required by the SiteScope API calls.

    5.jpg

SiteScope APIs test cases – Some examples

3.jpg

4.jpg

5.jpg

No prior knowledge required!

I started off with hardly any prior knowledge of Karate. And as you see, I was able to set up and start testing the SiteScope APIs. I was able to test a wide variety of complex validations using simple syntax as in the PUT and POST calls as shown in the preceding screen captures. SiteScope offers an exhaustive set of public APIs and having a tool that eases testing the APIs is a boon indeed for all the automation enthusiasts. Don’t you agree?

Explore

If you would like to learn more about Micro Focus SiteScope, start a free trial, or see a live demo please visit our online page at: https://software.microfocus.com/en-us/products/sitescope-application-monitoring/overview.

To read more about some cool features of SiteScope, visit our SiteScope Blogs and Videos Archive.

You can read up more details on Karate on https://github.com/intuit/karate#

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.