1

I have five different URL end-points(environments) for production and for QA and I need to execute the same features in all these production environments in a single run and get the result in one cucumber report- (In TestNG I was passing each environment as the parameter in separate XML file and then use a common TESTNG.XML file that contains all these XML,s with different environments).

How can I manage this in Karate-config file?

I have below production environments ProdV1,ProdV2,ProdV3 and ProdV4.

    {
   "prod":{
      "endpoint_urls":{
         "ProdV1":"https://production1.com/prod/ProdV1",
         "ProdV2":"https://production2.com/prod/ProdV2"
         "ProdV3":"https://production.com/prod/ProdV3",
         "ProdV4":"https://production.com/prod/ProdV4"
      }
   },
   "uat":{
      "endpoint_urls":{
         "UatV1":"https://uat.abc.com/uat1/home-sec-uri",
         "Uatv2":"https://uat.abc.com/uat2/home-res-uri"
      }
   }
}

Using command line I know we can run a single environment by command 'mvn clean -Dtest=TestRunner -DCucumber.Options="--tags " DProvEnv=ProdV1 '. But my question is how to run on all these production environments ProdV1, ProdV2,ProdV3 and ProdV4 together in a single run. Do we need to use for-loop? or is there any way other than that?

Sumith
  • 123
  • 8

1 Answers1

0

If you are running them all the time this is just data-driven testing: https://github.com/intuit/karate#data-driven-tests

Or there are many ways to loop over a data-set: https://github.com/intuit/karate#data-driven-features

If you ever want flexibility to not run some of them, use tags: https://github.com/intuit/karate#tags

Finally there are options where you can manage the data-set to loop in karate-config.js: https://stackoverflow.com/a/49693808/143475

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • Thank you. I have updated the question. In production itself I have 4 environments and I need to run on all these environments in a single run .How to run on all these production environments ProdV1, ProdV2,ProdV3 and ProdV4 together in a single run. Do we need to use for-loop? or is there any way other than that? – Sumith Jul 05 '20 at 20:46
  • @Sumith you call it an "environment" but to me it is just a JSON file with 4 values that you use to do data-driven testing, now go and re-read the links I posted. – Peter Thomas Jul 06 '20 at 02:08
  • Sorry I tried but I was not able to get it. I saw how to call other feature with a json array but my requirement is, I have 12 feature file all using Background: * url urlendpoint, where 'urlendpoint' is sent from karate config. I need to first execute all that 12 features with one environment url -ProdV1. then again the execute that 12 feature with with other url -ProdV1 on a loop . – Sumith Jul 09 '20 at 22:39
  • @Sumith I think I have done my best to give you a solution, if you read the links. I am giving up, over to other Karate users who might help you – Peter Thomas Jul 10 '20 at 02:13