Execute End to End Testing by Combining API and WEB Tests

Source: https://www.aditiconsulting.com/worlds-top-software-testing-professionals/

Probation period at the company has finished and the atmosphere is calmer than usual. Therefore, this is the right moment to create a story. As per my position as QA Engineer, the closest thing to my job is software testing.

Some people might still not know what software testing is. The definition may vary depending on the source, but in general the point is same, namely ensuring the actual result is same as expected result.

Software Testing

Software testing is defined as an activity to check whether the actual results match the expected results and to ensure that the software system is defect free.

There are more than 150 types of testing types and still adding. At this time we will only discuss about API and WEB testing according to the title of this article.

API Testing

Unlike WEB testing, API testing is performed at the message layer without GUI. Before combining two types of testing above, first identify what type of test will be performed on the API.

Commonly testing of APIs include: Unit Testing, Load Testing, Security Testing, Interoperability Testing, WS compliance Testing, Penetration Testing and Functional Testing.

In this discussion we will perform Functional Testing where this type of testing mainly focuses on functionality of API. This would include test cases to verify HTTP response codes, validation of response, error codes in case API return any error, and etc.

Web Testing

In web testing we will also perform Functional Testing.

Commonly testing of WEBs include: Functionality Testing, Usability testing, Interface Testing, Database Testing, Compatibility testing, Performance Testing, Security testing and Crowd Testing.

In Web Testing, Functional Testing is used to check if your product is as per the specifications you intended for it as well as the functional requirements you charted out for it in your developmental documentation.

From the title and explanation above, several questions arise in our minds and I have summarized them as follows


I hope three questions above can also represent all the questions that arise in the minds of readers.


  • Can Web and API test automation be done using a single framework for a website?

There are tons of software testing tools available in the market, and one of the tools that can be done Web and API test automation using a single framework is Katalon Studio.

Katalon is a powerful solution that helps you automate Web, API, Mobile, and Desktop.

Source: https://www.katalon.com/katalon-studio/

On official website of the Katalon, it is mentioned that Katalon quickly generate automated tests cross-platform. The sentence explains that the Katalon can be used to combine WEB and API test. The simple thing that will prove it is to make each test case for WEB and API where both are related one each other, then run using one test suite. The picture below is a Test Suite in which there are several test cases combined from the API and WEB:

Test Suite API and WEB
  • How to get value from API response and use it on WEB Testing to complete end to end test?

Before answering the question above, it is better if I explain what end to end testing is.

Based on the explanation above, what we want to do in end to end testing is to test the flow of an application from start to end. The selected flow is started from the loan application process to the loan repayment on Tunaiku application. The loan process will not be executed using the WEB/Mobile application but is executed using an API, thus shortening the time.

The steps are as follows:

1. Create an Object Repository for API Post Loan Data

Object Repository API Post Loan Data

Creating an object repository is same as making a request in postman such as filling the body, header, auth and endpoint. This aims to make it easier when making test cases, which only needs to call this repository object in the test case. For body requests, headers, auth and endpoints will not be shown because they are confidential.

2. Create a Test Case for API Post Loan Data

Test Case API Post Loan Data

To call Object repository in test case is shown in the following code:

Call Object Repository in Test Case

Actually, it only takes the bottom line to execute the post loan data API,
but because in the body request I set the PIN as parameterize, then I add the two line codes above to call a Keyword and to generate a random PIN. The keyword was created to generate a random string, the length of string is 16 digits, because in this API there is validation that the PIN used must be unique, so that a PIN that has already been used cannot be reused.

Here’s how the body request displays when PIN used is parameterize:

PIN is set parameterize

3. Convert API response into objects

After executing the API Post Loan Data, it will return a response. In Katalon, function to get API response is with getResponseText() as shown below:

Get and Print API Response

When printed, API response shown like this:

JSON text before convert to Object

In the response display above, there are some values ​​that we can process because they have values ​​such as id, status, and token. API response is returned in JSON text so it needs to be converted into objects by using JsonSlurper.

JsonSlurper is a class that parses JSON text or reader content into Groovy data structures (objects) such as maps, lists and primitive types like Integer, Double, Boolean and String.

Before it, we had to name JsonSlurper as something, in this case we have named JsonSlurper object as SlurperLoan. Then SlurperLoan is used to call the parseText function which will convert it to an Object, and in this case named as result.

Processing JSON Response

From the API Response shown above, the value to be retrieved and used in Web testing is id. To find out the value of id, we need to print and display it in the console with the following code:

Print value id

The code explains that we are printing the id value of the JSONResponse that has been converted to an object form in the result. But this value can only be taken only within the class, how to make it global?

4. Create Keyword
Keywords are needed, so every time we want the value we only need to call the keyword plus the value of which object we want to use.

Keyword Storing Data API

This keyword is used to store the value of the object being called.
The way it works is as follows:

  • Store id value in the Referral_Number variable
Store id value from API Response

This keyword will be called in the first Test Case: TC_Post_Loan_Data_With_Office_Address

Source code can be seen here:

  • Type value of the API response that is saved into a text field
Set text id to text field

This keyword will be called in the fourth Test Case:

Source code can be seen here:


5. Run End to End Test in Test Suite

In the End to End test there are several test cases that have been sorted in the Test Suite, and the order is like this:

Test Suite API_WEB End to End

To see the results of the Test Suite when running, please play this video and notice that the id in the API response will be written in the text field after successfully logging into the WEB application.

So, this is my first story. Hope it useful for you 😃. Thank you for reading 😎


Don’t say I can’t if you haven’t tried it. Whatever you do, do it with all your heart!


Easy read, easy understanding. A good writing is a writing that can be understood in easy ways

Wira Putrawan Pakpahan

Written by

I tried to plan my own plan very well but failed instantly. Then Lord said, I have planned better for you.



Easy read, easy understanding. A good writing is a writing that can be understood in easy ways

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade