I need to run the tests in a feature file with multiple endpoint urls. All the tests hit REST endpoints and I need to hit multiple endpoints for the same tests. I came up with the two below working solutions, but they both have maintenance overhead. So I was wondering if there is a better solution.
1. Add a dummy feature file: Add a new dummy feature file and call the actual feature file with the endpoint url as argument like below. The actual feature file has test data of 100 rows. So when this was executed individually, the cucumber report showed 100 scenarios and it was easy to see how many passed/failed. But when executed with the dummy feature file, the report shows only 1 scenario from the dummy feature file and shows all the 100 test cases underneath it.
Scenario: Call actual feature file with internal URL
* def params = { endpoint_url: 'internal' }
* karate.callSingle('actualTestCases.feature', params);
Scenario: Call actual feature file with public URL
* def params = { endpoint_url: 'public' }
* karate.callSingle('actualTestCases.feature', params);
2. Duplicate the test data rows and add a new column endpoint_url: In the test data, add duplicate test data rows, and add a column 'endpoint_url' with values like 'internal', 'public'. Use this column data in the actual feature file. This has the overhead that test data needs to be duplicated. I have more than 3000 rows of test data.
|testcaseName|email|endpoint_url
|"Valid Parameters"|["validtests@test.com"]|"internal"
|"Valid Parameters"|["validtests@test.com"]|"public"