1

From karate-config.js I need to know what .feature files are included in the run. Is there an easy way to access that?

As a work around, have discovered that if I re-write Karate's Runner.parallel function, I can pass the feature names in an argument:

...
Map<String, Object> args = new HashMap<String,Object>();
...
String featureList = "";
for (int i = 0; i < count; i++) {
   Resource resource = resources.get(i);
   Feature feature = FeatureParser.parse(resource);
   featureList = featureList + feature.getName();
}
args.put("featureList", featureList);
...
CallContext callContext = CallContext.forAsync(feature, options.hooks, options.hookFactory, args, false);

However, I dont know how to access the featureList argument from karate-config.js.

Is there an easy way to access the list of feature for a test run from karate-config.js?

Renaud
  • 55
  • 4

1 Answers1

0

This is not supported today. This is unlikely to be supported unless you contribute code because no one has ever requested this.

Do note that if you are anyway creating a list of features before you start the test, you can pass that to karate-config.js by means of a Java singleton.

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