QTP
Smart Identification in QTP/UFT with Example
What is Smart Identification in QTP? If the usual object identification process fails, Micro Focus...
Before Testing API, we need to know about API. An API (Application Programming Interface) is a collection of software functions and procedures which can be executed by other software applications.
API Testing is a software testing method for validating Application Programming Interfaces (APIs). The goal of API testing is to test the API in terms of functionality, reliability, security and performance. In API testing, a software is used to send inputs to the API and the output is recorded in order to test an API.
So API Testing is:
API Testing have four significant advantages
As you see the following figure, Api Testing grown up very fast in the last 10 years. It becomes very popular testing compared to other testing.
With API Testing we can use parallel execution to reduce test execution time. You can save up to 5 times compared to other testing Types.
In API Testing, data is exchanged via XML or JSON so that any language can be used to test the response. For example, if you have service whose response is in JSON format, you can easily parse data with Java, C# or any language.
There are many tools available both open-source and commercial. Micro Focus UFT is the best tool to execute API Test with simple UI and configuration.
The last version of QTP called HP Unified Functional Testing (UFT), is a combination of HP QTP (GUI testing tool) and HP Service Test (API testing tool). Also, QTP supports Web, Java, .Net, Oracle, Siebel, Web-services, and many other major language and platforms, which some older version doesn't support.
In this API testing in UFT tutorial, we will cover UFT API testing examples. We are going to test Graph API of Facebook. We will test API as Test Case below
Here is a step to build a test flow for this API.
Step 1: Open HP UFT and create new project API Testing
Click Create to create a project API Test.
Step 2: Adding HTTP Request to Test Flow.
We will use the HTTP Request to make a request to Facebook API.
Step 3: Configure and passing parameters into an HTTP request
https://graph.facebook.com/v2.3/me?access_token=CAACEdEose0cBANJsDnbZC92mNAghaM6xxZCZBZAvKlMXS98VYvKy%20OlrfAdsUWR8x5aw9Kqc0grscs9zb9IYED4VC3FwapIZBj%20dsuxy%20HdLcff38gYUBFNeRQlH%20fN7eXKoVZBNl0bR233ZAZCw8fLF1QLh98ry2ZBeYBhXLabtTDkFPZA1IqhaMG0mQp30zO1%20QxQ19nVCxZArJA6XRoB1o5FMepII5cn3DgbBmTgZD
Also, you can passing a parameter into to API by set values Request Header
You can use Graph API Explore of Facebook to get values of access_token.
A set Status code is "200" in Checkpoints part. Checkpoints allow you to see whether the action was successful without having to manually check the result. Checkpoints are the means to validate the test a success or failure is determined by its checkpoints. In case status code is 200 that means test case is passed.
Step3: Run the test
Click the Run button or press F5 to open Run Test dialog box. Click Run to compiler and run the test.
Step4: View the result
The Run Results Viewer opens. In this API testing using UFT example, if a test case is failed, test results like the following figure.
In case test case is passed, we have reported as below
Ok, now we have done your first API testing using UFT
Where to go from here
Now that you have learned to create a test with API test in UTF, you can create your own test for your GUI-less application.
API testing is the testing below the GUI and programmatically simulates data or control follow scenarios.
API testing is one of the most popular testings in the software development process because it has many advantages
There're many tools to perform the API testing, QTP is one of the best tools to do this test. Although QTP has some disadvantages, QTP is still a very powerful tool for API testing with its benefits
What is Smart Identification in QTP? If the usual object identification process fails, Micro Focus...
This tutorial introduces the Quick Test Professional IDE Launch UFT To launch HP QTP, In Start...
What is QTP Parameterization? QTP provides us to pick different test inputs at a run time. This...
What is Environment Variable? Environment variables are dynamic "object" on a computer that can...
What is Business Process Testing? Business Process Testing(BPT) is a process that aligns software...
This tutorial introduces Flight Reservation Application which will be used for hands-on for the...