In Rapi, users can prepare a dataset to run in a test case. For example, if you want to test a login website, you can import several login credentials into Rapi, and let Rapi test the login website with different sets of login data. This article is going to introduce how to perform a data-driven testing, to import data into Rapi and start testing!
Select the "Data Driven" tab, and press the "Import from file" button:
After selecting the imported data file, if the filename shows up u
⚠ Warning
If you're uploading a file that has the same name as an existing file, the upload process will fail. Please remove the existing file before uploading a new one.
FOR_EACH_RECORD
and END
commands.FOR_EACH_RECORD
as the command name,and type the filename of your dataset as the "Target" of the command. For example: ${YOUR_KEY}
to reference your data. For example:END
command at the end of the process:During playback, the FOR_EACH_RECORD
command will turn all the data from your file into global variables, and execute every command within FOR_EACH_RECORD
and END
with each set of data provided.
Your imported data can be seen in the "Global Var" tab:
From the execution logs, we can see that each record of data has been executed once:
If you want to perform one-to-many test, you can prepare 2 datasets and use nested FOR_EACH_RECORD
command to implement. Below shows an example: