To test a simple Get request, we should import 'RequestsLibrary' in settings because we want to make a request. In test cases, first, we should define a keyword for our test scenario, and then we should write the test steps in the keyword's scope.
This test case will call the endpoint and assert whether: 1- The endpoint responds with 200. 2- The response body contains 'Google' word. 3- The value of Content-Type is 'application/json' in response headers.
Each .robot file usually contains three main parts: Settings, Variables, and Test cases. In settings, you can import the libraries, suite setup, and documentation. In the variables part, you can put your variables, and the scenarios are written in the test cases section.
First, I define a variable to hold the base address of the API. Second, I put the URI of the API in another variable. You may ask why I put the URI in another variable. You will get your answer in the creating get request step.
Collection
[
|
...
]