1

I am trying to execute some feature file using karate runner(feature file is bundled with application jar file) from REST controller class call. In service class I am using karate runner to run the tests.

public Results executeTest(String featureFile, List<String> featureTags) {
   return Runner.path(featureFile).tags(featureTags).parallel(10);
}

Resource file exist under resources/abc.feature inside the jar file, so I am providing featureFile="classpath:abc.feature", also I have tried with featureFile="abc.feature" or featureFile="./abc.feature", but Karate is not able to find the feature file. Is there a way to pass the file path of feature file which is inside the jar file?

Shashi Ranjan
  • 87
  • 1
  • 10

1 Answers1

0

Yes, try using the classpath: prefix: https://github.com/karatelabs/karate#reading-files

For example:

Runner.path("classpath:abc.feature").parallel(1);

Also see: https://stackoverflow.com/a/58339662/143475

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • It works while I am running the application from eclipse but when I am running the spring-boot jar, It is not finding the file. Ideally It should have been worked! By the way, how karate is loading the file? using `getresourceasstream` or anything else? – Shashi Ranjan Sep 28 '22 at 08:52