Validations and Request Arguments


Welcome to ZAPTEST tutorials! In this tutorial we will show you how to use validations and customize request arguments in ZAPTEST API calls. During this lesson you will learn about ZAPTEST API Studio How to define parameters in a service request And how to validate server response values In the tutorial exercises we will be using demo web services provided by ZAPTEST for educational purposes. The servers address is displayed here We will start by defining a new API server Object; here we will type a name for the server’s object; type the demo API server’s URL; and select the check box to load the WSDL data. Next, we will select the Get Company Name method, this method returns the value of the ZAPTEST company name. For customization of any request attributes ZAPTEST provides the API Studio Module. To define a validation checkpoint for the server’s response we will navigate to the checklist tab. Here, we can type the expected value directly into the value field or we can use a data table parameter. For a new parameter we will type its name and ZAPTEST for its value. To define a validation step we will drag the Get Company Name API Object into the step view and select the Execute and Check Response by list operation. We can view or update the parameters value directly by using the data table tab. Now, we will save the new test and run it. Once the test run has finished, we will open the results. The execute and check step has returned a failed status because the actual company name is different from the value that we used in the checklist. Next, we will update the company name parameter with the correct value; and re-run this test. The execute and check response step must return a pass status. For the next step in our test we will use the Sum API method; this method performs addition of two numbers and returns the result. We need to use the Request Body tab to specify the arguments values. For argument A, we will define a data table parameter INT 1 with the number 2 as its value For argument B, we will define a data table parameter INT 2 with the number 3 as its value From the check list tab, we will define a data table parameter SUM with the number 5 as its value Next, we will make a step for the method in the step view and select the execute and check response by list operation. Now we will save and run the test. The test results must display a passed status for the second step. For our next step in our test, we will use the Concat Array Data API Method. This method returns a concatenated string of values in the argument array. We will navigate to the Request Body Tab and define two array items. For the first one, we will make a new data table parameter with name STR 1, with the value Hello. For the second one, we need to define a name and value, we will make a new data table parameter name STR 2, with the value World From the check list tab, we will define a data table parameter STRCONC with value Hello World Next, we will make a step for the method in the step view and select the execute and check response by list operation. Now we will run our test and review its results. The last step, Concat Array Data must display a passed status. In this tutorial lesson, you have learned how to Use ZAPTEST API Studio controls How to define request arguments using data table parameters And how to specify expected check list values for a response validation Thank you for using ZAPTEST!

Contact Us

Tower Place 100

3340 Peachtree Rd NE #1800 

Atlanta, GA 30326 USA

(404) 814-5227