In Robot Framework, we can use Test Template to perform data-driven testing. However, in this method, the number of test cases are fixed. We are not able to add new test cas
I am not sure if you are really looking to create separate Test Cases (ie. with separate PASS / FAIL status etc in the output report), or simply looking to repeat a sequence of test steps using a set of data?
If the latter, you can easily read in lines from external files using the OperatingSystem library, parse the contents of the file using the String library, then repeatedly call a user keyword with the contents of each line.
| *** Settings ***
| Library | OperatingSystem | WITH NAME | os |
| Library | String | WITH NAME | str |
| *** Test Cases *** |
| Read Data From File |
| | ${fileContents}= | os.Get File | data.txt |
| | ${rows}= | str.Split To Lines | ${fileContents} |
| | :FOR | ${row} | IN | @{rows} |
| | | ${cols}= | str.Split String | ${row} | , |
| | | My Test Keyword | @{cols} |
| *** Keywords *** |
| My Test Keyword |
| | [Arguments] | @{fields} |
| | Log Many | ${fields} |
The first failure of My Test Keyword would normally fail the entire Read Data From File test case. If you wanted to run as many as possible, and then collate the results, use the Run Keyword And Ignore Error keyword from the BuiltIn library.