Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Karate NPM - how to pass values from karate-config.js file to feature file

$
0
0

Please note this is a nodejs project and I use karate NPM

#! /usr/bin/env nodeconst karate = require("@karatelabs/karate");karate.version = "1.3.0";let env = process.env["KARATE_ENV"];karate.properties["env"] = env;console.log("karate.env: ", env);function fn() {  let configData = {};  if (env == "dev") {    configData.baseURL = "http://localhost:3010";    configData.testData = "test/dev/";    configData.utilityPath = "utility/";  } else if (env == "qa") {    configData.baseURL = "http://localhost:3010";    configData.testData = "test/qa/";    configData.utilityPath = "utility/";  }  return configData;}// Execute the function and store the configvar config = fn();// Run the tests in the specified folderkarate.exec();

this is my karate-config.js file. I want to access this config data in my feature file.I tried multiple options but it didn't worked

I tried passing it in karate.env, karate.config also tried to add it in karate.properties but all failed to get data in feature file.


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>