I want to run Scenario Outline in loop for one of the variable configurable

212 Views Asked by At

I have use case in which I am making server name configurable using Scenario outline for get call. But I also want to make another variable like ID configurable. I want using that id it should run for all server name mentioned in Scenario Outline. How can we achieve that?

Example

Scenario Outline: Test one get call Given url: 'https://' + server+ 'v1/share/12345/profit' When method get Then status 200

Examples: |server| |server1| |server2| |server3| |server4|

In above example server name, I made it configurable using scenario outline, but I want to make number entered in URL configurable & want that to run for all servers. How I will achieve that?

1

There are 1 best solutions below

0
Peter Thomas On

Just use another variable.

Examples:
| server | id   |
| foo    | 1    |
| foo    | 2    |
| bar    | 1    |
| bar    | 2    |

And if you want to dynamically generate data using a function, all that is possible. Refer: https://github.com/karatelabs/karate#json-function-data-source