1

I would like to re-use karate feature file present in a JAR (added as dependency to the working maven java project). In the documentation at https://github.com/intuit/karate#karate-basejs, I can see the following :

Advanced users who build frameworks on top of Karate have the option to supply a karate-base.js file that Karate will look for on the classpath:. This is useful when you ship a JAR file containing re-usable features and JavaScript / Java code and want to 'default' a few variables that teams can 'inherit' from

But I do not understand how can I achieve this. Is it possible to share any example where the karate features present in a dependency JAR are called from a karate feature file

  • you need to be familiar with creating and using JAR files of course. if the answer below and the linked question don't help, please assume that this is not supported by karate but you are welcome to contribute code – Peter Thomas Apr 15 '21 at 06:48

1 Answers1

0

There is only one rule you need to be aware of. If a file exists on the Java classpath, Karate can read it if you use a classpath: prefix. This is explained in detail in the documentation: https://github.com/intuit/karate#reading-files - and you can find links to examples there.

So how you create a JAR file and how you add that to the classpath is up to you and has nothing to do with Karate.

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