rado
rado

Reputation: 45

Running Karate tests on different environments and per specific url

I'm doing the research for my QA project and I'm wondering if Karate is able to handle certain use cases. Basically I need to run tests for different environments (local, staging, production). What I understood from the documentation, it is not a problem because of karate-config.js and karate-config-env.js.

The problem starts with the execution itself. Each environment has different urls for 3 different countries, so actually there are 9 urls in total. Moreover, because of the development process, certain features are deployed not at the same time for all countries. So I want to be able to run tests against: 1 - staging for one country (one url) 2 - staging for all countries (the same request with 3 urls, I guess I can use parallel execution)

The json structure is the same for all environments and countries and I want to execute one request with different configurations. I was thinking about TDD but I'm not sure if I can skipp some rows from Scenario Outline table if I'm executing tests for only one country. Is it possible? or is there any other way? Any advice appreciated.

Upvotes: 1

Views: 1602

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

You can "tagify" Scenario Outline rows. See the docs: https://github.com/intuit/karate#tags-and-examples

Scenario Outline: examples partitioned by tag
* def vals = karate.tagValues
* match vals.region[0] == expected

  @region=US
  Examples:
    | expected |
    | US       |

  @region=GB
  Examples:
    | expected |
    | GB       |

Karate can handle pretty much any data-driven challenge you have, once you understand how JSON, manipulating JSON and data-driven testing works. Here are some answers that will give you further ideas to consider:

https://stackoverflow.com/a/61685169/143475

https://stackoverflow.com/a/59162760/143475

Upvotes: 1

Related Questions