Switch back to the Manual view of the test case and set those two variables as inputs for the username/password fields. Switch to the Variables tab of the test case and create two variables named ‘demo_usn’ and ‘demo_pwd.’Ĥ. In order to run this script multiple times using different accounts, you need to parameterize these values. You can see that the input values for username and password are hard-coded as what you typed during recording (in this case it’s admin/abc123). The generated test case should be similar to the following: Refer to this guide for more details on the Record & Playback feature of Katalon Studio.Ģ. You can utilize the Web Record function to quickly generate test steps.
This tutorial will provide you a simple example on how to create an automation test case and execute it multiple times using different sets of data.
Katalon Studio supports data-driven testing which allows users to define data sets and execute test scripts that use these data sets.
This approach may be useful mostly for searching in tables when you don't have unique identifier for table data elements, but it can be applied to any other element.Data-driven testing (DDT) is a term used in the testing of computer software to describe testing done using a table of conditions directly as test inputs and verifiable outputs as well as the process where test environment settings and control are not hard-coded.ĭata Driven Testing can be best understood by the following diagram:ĭata-Driven Testing Approach With Katalon Studio Get N-th element when there are multiple (and same) siblings. In our case, for contains method, you provide a result of text() method as a haystack and substring as a needle.Ħ. small**You may see that in the first option, you have to specify exact text, whereas, in the second option, it is enough to provide only a substring. Text() returns a text of current node, contains() returns true/false based on parameters.Example: XPath offers several functions, but probably most used for test automation are text() and contains(haystack, needle) methods. when the same image is used on multiple places, but alt attribute is different. **This may be useful when a single attribute may not be sufficient to identify an element, i.e. Use XPath operator and to get element by multiple " and logo"] So relative Xpath approach can be easily applied.Ĥ. Then, use relative Xpath to locate your p does not have any unique ID, but its nearest ancestor (parent element) has. If unique identifier is not present, find nearest ancestor/descendant with unique identifier. Prefer using direct XPath (when unique identifier is id is (should be) unique within a page, so you may be sure that you are about to use correct element.ģ. If possible, keep your XPaths easy and short. This example does not look so bad, BUT – in feature-rich websites, you may have 15-20 elements between the root element and your object.Ģ. Sample absolute Xpath in our sample code: It works, but it is really hard to maintain – even the smallest change in page's source code can make Xpath invalid. Use this only and only when there is no other choice. The very best and ultimate practice is to avoid using absolute Xpaths.