1

I have a test script which execute some set of queries, to execute the file, inputs like url and auth header are needed which will differ for each environment

So, I need to get those inputs from user, how to get these inputs as part of command to execute the karate file.

Background:

  • Given url <url>
  • header Authorization = <token>

Instead of hardcoding the url and token, this has to be get from user

Barmar
  • 741,623
  • 53
  • 500
  • 612
Sangeetha
  • 11
  • 1

1 Answers1

0

Please read up on how to switch environments in Karate first: https://github.com/karatelabs/karate#switching-the-environment

This requires you to understand how to use a file called karate-config.js. You can place it in the root of your working folder or you can specify the location on the command-line.

So passing -e e2e as a command-line argument will set the karate.env to e2e.

If you really want to get extra values from the environment or command-line, please refer to this answer: https://stackoverflow.com/a/52821230/143475

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248