In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces katalon how to achieve data-driven testing related knowledge, detailed and easy to understand, simple and fast operation, with certain reference value, I believe that everyone will have some gains after reading this katalon how to achieve data-driven testing article, let's take a look at it.
What is Data Driven Testing?
I believe that smart friends can probably guess what a data-driven test is when they see this word, right? Simply put, data-driven testing is a simplified approach to test cases. For example, the original login test, engineers need to test multiple accounts, each account counts as a test case, which will generate a lot of test cases, and the idea of data-driven testing is to extract the same logical steps and use variables to replace different parameters in the test case (is this operation a bit like a function?). Then collect the previous different parameters as a data pool. When you need to execute the corresponding test case, you only need to pass the corresponding parameters in.
Take a simple login as an example. The login process is as follows: open the webpage-> enter the account-> enter the password-> click login-> login successfully. Suppose we need to test ten accounts, then there will be ten test cases, if data-driven testing is adopted, that is, one test case +10 sets of data, which greatly improves the efficiency of case management.
Katalon Recorder How to do data-driven testing
You can see that katalon has a row of consoles at the bottom, where we only need to focus on the variable and data driven windows, where the data-driven related functions are controlled.
Step 1: Record a case.
We simply record a case, the specific process is as follows: open Baidu-> input data (here we input data for W3Cschool, in addition in the program here is divided into two steps, one step first click the input box, the second step is to input data)-> click login.
The above is the recorded script. In fact, we can find that the instructions inside the red box will be different for each test case (that is, the data we want to extract), and the green box inside the red box is the data value we need to insert.
Step 2: Use Variable Substitution
We can see that the green box is a fixed value, but our goal is to make it a parameter, so the second step is to replace the original value with a variable.
We set the value of w3cschool to ${keyword}.
Third, surround the repeat item with a loop script.
Insert a loop script into the script above. Add the loadVars command before the command line and endLoadVars after the command line.
Step 4: Add a data pool
Add the data pool at target in the start command of the loop script.
More about data pools is covered in the next point.
After adding the data driver, you can execute it.
How to make a data pool
In the fourth step of the above process, you need to import a data pool. How do you do this? First of all, katalon supports two ways of importing, one is JSON import, the other is csv import, two kinds of data pool production must first determine one thing: what kind of data the caller wants to get.
In the example above, we named a variable keyword (retrieved using ${keyword} in the script), so a key attribute of our datapool is keyword.
In JSON, the data is stored in key-value pairs, so each piece of data has to carry the keyword attribute name, so the corresponding JSON should be like this:
[ { "keyword": "" }, { "keyword": "small action" }, { "keyword": "six items of refinement" }]
In csv (csv can be opened using excel), just name the first line keyword.
Note that pay attention to the encoded character set of the data pool, otherwise garbled characters may appear.
Add a data pool
After you finish the data pool, you need to add it to the data drive.
On the right side of the data driven panel, you can add CSV format and JSON format data pools. Click to select the completed data pool to add.
The added pool is ready for use in step 4 above.
other
After completing the above steps, you can see the variable values and their attributes used by the current code, which is convenient for developers to debug the code.
The content of this article on "katalon how to implement data-driven testing" is introduced here, thank you for reading! I believe everyone has a certain understanding of the knowledge of "katalon how to realize data-driven testing." If you still want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.