KEYWORD Execute Test Case Log Running dynamic test execution
Start / End / Elapsed: 20250129 17:26:37.991 / 20250129 17:26:37.992 / 00:00:00.001
17:26:37.992 FAIL Keyword ‘Execute Test Case’ expected 3 arguments, got 2.
csv file contains 3 columns, 3 arguments passed. still getting this error.
content of csv file
${TestCaseID};${TestDataID};${JobID}
TC004;TD001;J004
TC004;TD002;J005
TC004;TD003;J006
Hi Divya,
You didn’t show your robot file, given the error your getting it’s likely that’s where the problem is.
As there’s not enough information here for anyone to help you, all I can do is suggest you read this page from the user guides, and the datadriver home page
Dave.
1 Like
Hey,
You’re encountering is due to the Execute Test Case keyword expecting three arguments, but only two are being passed in your test case execution. Given that your CSV file contains three columns, you’re passing the correct number of arguments, so the issue might be related to how the arguments are being extracted from the CSV.
Here are a few things to check:
CSV Parsing Issue: Ensure that the CSV file is being read properly and the values are being split correctly into three variables (${TestCaseID}, ${TestDataID}, ${JobID}). You could print the extracted values in the log to verify that the variables are being populated as expected.
Check How You’re Passing Arguments: When calling the Execute Test Case keyword, make sure you’re passing the arguments correctly, like so: Execute Test Case ${TestCaseID} ${TestDataID} ${JobID}
This assumes ${TestCaseID}, ${TestDataID}, and ${JobID} are being correctly populated from the CSV.
Argument Reference: If you’re using a loop to iterate through the rows in the CSV file, check that the correct number of arguments is being passed during each iteration. For example, ensure that you’re properly extracting each column value and passing them as arguments.
Check Test Case Keyword: Double-check the definition of the Execute Test Case keyword. If it’s a custom keyword, ensure that it’s defined to accept three arguments. If it’s a built-in keyword, confirm that you’re using it correctly in your test suite.
Best Regard,
Nathan
It seems like there might be an issue with how the arguments are being passed from your CSV file to the Execute Test Case
keyword. Here are a few things to check:
-
CSV Delimiter: Ensure the CSV file uses the correct delimiter. In your example, semicolons are used (;
), but if the parsing function expects a different delimiter (e.g., comma ,
), it might not correctly interpret the columns.
-
Arguments Format: Double-check the format in which the arguments are being passed to the Execute Test Case
keyword. The columns in the CSV file should match the expected arguments in the test case.
-
CSV Parsing: Verify that the script or tool you are using to parse the CSV file correctly extracts all three columns and passes them as arguments to the keyword.
Here’s a simplified example of how you might read from a CSV file and pass the arguments in Python, using the csv
library:
import csv
with open('test_cases.csv', mode='r') as file:
reader = csv.reader(file, delimiter=';') # Adjust delimiter if needed
for row in reader:
if len(row) == 3:
test_case_id, test_data_id, job_id = row
execute_test_case(test_case_id, test_data_id, job_id)
else:
print(f"Error: Expected 3 arguments, got {len(row)}")
def execute_test_case(test_case_id, test_data_id, job_id):
print(f"Executing test case {test_case_id} with data {test_data_id} and job {job_id}")
# Add your test case execution logic here
Make sure your CSV file test_cases.csv
is correctly formatted with semicolons as delimiters if that’s what your script expects. If you continue to have issues, please provide more details about the environment or tool you are using for running these tests, and I can offer more specific advice.
1 Like