I can obtain feature file name on JS/Feature file perfectly fine using karate.info.featureFileName;
however I am wondering how to obtain the feat on java file?
I have the need to use custom execution hook for beforeStep
So far I have come up with this:
System.out.println(context.getFeatureContext().feature.getName());
However it is printing the feature name instead of the file name FindStoryByID
. It returns:
Test GraphQL Find Story By ID
Is it possible to get the feature file name through the context?
Thanks a lot!
This will do it:
File f = null;
f = context.getFeatureContext().feature.getPath().toFile();
String name = f.getName();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.