1

I am setting the environment variable using karate-config.js if its null:

 if (!env) {
    env = 'sit';
  }

I am able to fetch env value in karate feature file, however my test case requirement is to pick the excel data based on environment

When I am using the below code to read the file name based on env, I am getting null as env

file= file.replace("RequestData.xlsx","RequestData-"+System.getProperty("env")+".xlsx");
abdul khan
  • 173
  • 5
  • if still stuck follow this process: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Jan 17 '22 at 14:48
  • Hi @PeterThomas : Really sorry the solution that suggested did not worked in my case as I want to set the environment variables at runtime which I am setting in karate-config.js and use it java custom java code. – abdul khan Jan 17 '22 at 15:44
  • I have only one extra comment. the system property name is `karate.env`. if that doesn't work, try passing parameters to java code from karate, there are plenty of examples if you search and read the docs – Peter Thomas Jan 17 '22 at 15:50

0 Answers0