JMeter Webservice API test Plan

Source: Internet
Author: User
Tags wsdl

Web Services

A Web service is defined as a software system designed to support interaction between two machines over a network. It is designed to have an interface that is described in a machine-readable format that is typically specified in the Web Services Description Language (WSDL). In general, "HTTP" is the most commonly used communication protocol. Web services also use Soap,rest and xml-rpc as a means of communication.

The Web service may not contain a complete set of specifications and may sometimes fail to perform all the tasks that the full API might perform.

API (Application programming Interface)

The API acts as an interface between two different applications so that they can communicate with each other. This is a way for third-party vendors to write programs that are easily connected to other programs. The API can use any communication method to initiate interaction between applications. For example, the Linux kernel API uses interrupts to invoke system calls.

The API contains a complete set of rules and specifications for software programs to follow for easy interaction.

Web API

Web APIs can be seen as a development in Web services where the focus has shifted to simpler communication based on presentation State transfer (REST). The Restful API does not require XML-based Web service protocols (SOAP and WSDL) to support its interfaces.

Web services are broadly divided into two categories:

    • Simple Object Access Protocol (SOAP)
    • Substituting state transfer (REST)

For testing purposes, we will use some publicly available rest APIs to test the JMeter.

You can search the Internet for a wide variety of publicly available rest APIs. And get the API key to set up the test in JMeter. You can also use any development environment to build an entire Web service project and deploy it on JMeter to run a test plan.

For this test, we are using the API provided under the URL in the Open Weather map website:

Https://openweathermap.org/api

Shows the API section provided by the Open Weather map website.

You can register on this website to access your API key, which is then used to obtain the correct weather report.

In our example, the generated API key:3f25ec8eed9e1951e21407a34312c2c8

Shows the API key generated after a successful login.

We will now use this API key and the method of invoking the API to get the desired results. The method that invokes the API includes the server name, followed by the city Code/city name and the API key.

Shows an example of API invocation provided by the OPENWEATHERMAP Web site.

Now we will create a test plan to test the rest API provided by the Openweathermap Web site.

Create a JMeter test plan
    • Go to the JMeter/bin folder and double-click the jmeter.bat file to launch the JMeter interface.
    • Click the Test Plan node.
    • Rename this test plan node to: webservicetest .
    • Select the webservicetest node, and then right-click the selected item.
    • Hover over the "ADD" option and the list of elements will be displayed.
    • Select thread (user) > Thread group.

Modify the following properties of the thread group:

    • Name-Webservice User
    • Number of threads (user)-2
    • Acceleration Period-Leave the default value (1).
    • Cycle Count-1

Add Sampler
    • Select the Webservice user Element (thread group), and then right-click the selected item.
    • Hover over the "ADD" option and the list of elements will be displayed.
    • Select sampler> HTTP Request.

Set the following fields in the HTTP request Control Panel:

    • Name-HTTP request
    • Server name or ip-api.openweathermap.org
    • Path-Data/2.5/weather
    • Parameter-q = London
    • AppID = 3f25ec8eed9e1951e21407a34312c2c8

Add Listener

The listener element will be responsible for storing all the results of an HTTP request in a file and rendering a visual model of the data.

    • Select the Webservice user element.
    • Hover over the "ADD" option and the list of elements will be displayed.
    • Select the listener> View Results Tree option.

save and execute a test plan
    • Click File > Save Test Plan as.
    • Save the entire test plan as http_test.jmx.
    • Click Run > Start to execute the test plan.
Validate Output

The following output can be seen in the listener.

In the Response Data tab, you can see the actual weather reports provided by the Openweathermap Web site.

JMeter Webservice API test Plan

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.