UI and API Steps (Script-Less)

Welcome to ZAPTEST tutorials! In this tutorial we will show you how to create a test that includes API and UI related steps. During this lesson you will learn How to use an iteration as an index for an array element How to create and use a dynamic path for an API response And how to combine API calls and UI steps in one test 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 the name for the server’s object, the demo API server’s URL; and select the check box to load the WSDL data. Next, we will select the Get Test Accounts API Method and drag it to the step view. This method returns an array of test user accounts. For the operation we will select Execute. To retrieve a username from the server’s response we need to provide a path; in addition, we need to use the data table Iteration number as an index in the path. We will use the ZAP utility object to get the Iteration number and save it to a variable. Next, we will use the ZAP utility object and String CONCAT Method to create the paths string. And we will use another String CONCAT step to complete the paths composition. Now we will use the paths string to extract the username value; to define a step for this we will drag the local variable item; type a name for the variable; drag the method from the API Explorer; select the Get Member Response operation; and use the path variable for its argument. We will add a custom report step to output the username value to the test results. Now, we can save our test and run it. Once the test run is complete, we will open the test results and verify the username value. We will use the username for login to the ZAPTEST website. Next, we will add steps to perform the login. We will start by using the GUI scan to scan a browser window with the ZAPTEST homepage. On this view we will select and keep two objects for the ZAPTEST logo and the Login link. Next, we will scan the login page. On this view we will keep objects required for the username and password entry. We can change names for the edit field objects. Next, we will scan the user zone page; on this view we will select and keep the object for the Welcome message. Once we have all these objects, we will add steps to our test. We will use the ZAP Application Object and the Launch Method. For its first argument we will define a new data table parameter for browser type For the second argument we will type the ZAPTEST website address. Next, we will add steps to validate the home page; click the login link and validate the login page. For the username type step, we will use our username variable; in the password type step, we will include enter keyword to submit the login form. After a login we need to validate a Welcome greeting; which includes a dynamic username. To make its text we need to concatenate two strings; Welcome and the Username. For this we will drag the ZAP Utility Object and select the String Concat Method. We will type Welcome in its first argument and use Username variable for its second argument. For the output parameter we will use a new variable - Welcome Text. We will use the Welcome object and Set Property Method to update its text property value from the variable. In the last step we will use the Welcome Object and the Exist Method to validate it. Before running this test, we will navigate to the data table and add two rows to the browser parameter for Chrome and Internet Explorer. This will make our test run three iterations on different browsers. Our test is ready, we will save and run it after closing any open browser windows. After the test run has finished, we will open the test results and verify that all the steps have a passed status. Also, different test user accounts must be used in different iterations. In this tutorial lesson, you have learned how to How to use an iteration to extract an array element How to use a dynamic path to parse an API response And how to combine API and UI related steps in the same test Thank you for using ZAPTEST!

Contact Us

3150 Roswell Rd NW

Atlanta, GA, 30305, USA

(800) 795-3552