Skip to content
/ .. / .. /
Simple GET Request





Simple GET Request

In this tutorial, we will demonstrate how to create a basic test case to execute a GET request using the HTTP Built-ins.

1. Create Steps Language File

Right-click on the steps folder -> New -> Steps.

Write SimpleGetRequest as the file name and field and click OK:

alt text

The extension .steps will be appended to your file name. A new window with a Stepdef and Model template will appear:

alt text

Replace the text with the following:

1
2
3
4
5
6
7
stepdef "execute simple get request"
    request := Http.get("https://httpbin.org/get")
        .addHeader("Content-Type", "text/plain")
        .build()
    response := Http.executeHttpRequest(request)
    response.writeToFile(File.fromProject("simple-get-response.txt"))
end

2. Create Feature File

Create a new directory to store your features in by right clicking on the project name -> New -> Directory.

Write features and click OK.

Create a Feature File by right-clicking on the new features folder -> New -> Feature.

Write SimpleGetRequest in the File name field, Simple Get Request in the Scenario name and click OK.

A Feature File template will appear, which will look like the following:

alt text

Replace the Feature File text with the following:

1
2
3
4
Feature: SimpleGetRequest
  Scenario: Simple Get Request
    # Execution
    And execute simple get request

Execute the Feature File by right-clicking on the Feature File -> Run... which creates a file called simple-get-response.txt in the project root directory.

A file with a message like below will be displayed:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
  "args": {},
  "headers": {
    "Accept-Encoding": "gzip,deflate",
    "Connection": "close",
    "Content-Type": "text/plain",
    "Host": "httpbin.org",
    "User-Agent": "Apache-HttpClient/4.5.3 (Java/1.8.0_121)"
  },
  "origin": "8.8.8.8",
  "url": "https://httpbin.org/get"
}