简体   繁体   English

如何在空手道功能文件中使用自定义路径?

[英]How to use custom path in karate feature file?

In the karate feature file, classpath is - "scr/test/java"在空手道特征文件中,类路径是 - "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?但是,详细的“classpath:examples/resources/module1/sub_module/test.json”路径,还有其他隐藏详细路径的方法吗? like喜欢

Here, My expectation is Instead of在这里,我的期望是

  • def file1 = read(classpath:examples/resources/module1/sub_module/test.json) 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. def file1 = read(customclasspath:test.json) 或类似的可以隐藏功能文件中任何文件的完整路径详细信息。

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更多关于变量替换的提示可以在这里找到: https://stackoverflow.com/a/73230200/143475

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM