1

In the karate feature file, classpath is - "scr/test/java"

But instead, the detailed "classpath:examples/resources/module1/sub_module/test.json" path, Is there any other way that hides the detailed path? like

Here, My expectation is Instead of

  • def file1 = read(classpath:examples/resources/module1/sub_module/test.json)

I want to use

  • def file1 = read(customclasspath:test.json) or similar to this which can hide the full path details of any file in the feature file.
Dream_hat
  • 51
  • 5

1 Answers1

1

Just use a variable?

* def myPath = 'classpath:foo/bar/'

And then later:

* def file1 = read(myPath + 'test.json')

More hints on variable substitution can be found here: https://stackoverflow.com/a/73230200/143475

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