![]() ![]() ListUser.xlsx is an excel file that contains the user information.To view the data files in this sample project, in the Test Explorer panel, go to Data Files > ListUser.Īlternatively, you can go to \Data Files and choose the file you want to open: Int id = CustomKeywords.''(age as Integer, username, password, gender, 200)ĬustomKeywords.''(id, age as Integer, username, password, gender, 200) Import .testobject.RequestObject as RequestObject Import internal.GlobalVariable as GlobalVariableĬustomKeywords.''(age as Integer, username, password, gender, 200) Import .testobject.TestObject as TestObject Import .model.FailureHandling as FailureHandling Import .checkpoint.Checkpoint as Checkpoint There are two test cases for different purposes: To access the sample test cases in this project, in the Test Explorer panel, go to the Test Cases folder. ![]() Execute verification snippets in the Verification tab of the GET request.Send the GET request to retrieve user information by the userID.Extract the new user ID from the response.Execute verification snippets in the Verification tab of the POST request.Send the POST request to the server to create an account, then return a userID as the response.To see the custom keywords, in the Test Explorer panel, go to Keywords > sample > oovy. Katalon creates two custom keywords in this sample project. To learn more about custom keywords, you can refer to this document: Introduction to custom keywords. You can use custom keywords in the test case. We don't specify any authorization, HTTP header, or HTTP body for this sample GET request. Authorization & HTTP Header & HTTP Body:. ![]() Conversely, you can disable this option to prevent automatically redirecting such requests that return a 3xx series response, you can examine and manage the redirection manually. The Follow redirects option allows you to automatically make a new request when the server responds with a 3xx status. We specify the value for the id variable in the Variables tab. For the POST request, we specify the API endpoint as follows: $, with the base URL is listed as a global variable. Any mismatch between method and URL leads to an invalid request exception at runtime or a wrong data response. The server will return us with a new userID as a response.Īlong with the request method, request URL is to tell the web server which API is utilized under test. Here, we create a POST request to send the user information to the server to create an account. The method needs to match the API endpoint to be a valid request. Katalon allows you to choose one of the following methods: GET, POST, PUT, DELETE, PATCH, HEAD, CONNECT, OPTIONS, TRACE. In this sample POST object, we specify the following information: To access the sample RESTful requests, in the Test Explorer panel, go to the Object Repository folder. We created two sample RESTful requests in this project: a POST request and a GET request. Katalon creates three global variables in this sample project as follows: Name To learn more about execution profile, you can refer to this document: Execution profile. They can be used across test cases in your project. You can create and save all global variables in the execution profile. To open the execution profile, go to Profiles > default. Sample API project components in Katalon Studio Profiles To open the API sample project, in Katalon Studio, go to File > New Sample Project > Sample API Tests Project.Īlternatively, you can download the sample API test project from our GitHub repository: Web Service tests. To learn more about API testing, you can refer to this document: Introduction to API testing. This sample demonstrates fundamental API testing with RESTful requests. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |