vendredi 22 janvier 2021

Karate Automation Test Framework - need access to list of features included in run from karate-config.js

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?

Aucun commentaire:

Enregistrer un commentaire