如何使用绝对路径代替class路径读取文件
How to use absolute path instead of class path to read files
我想将所有资源 file/scripts/payload 存储在一个包中,并通过调用函数读取该文件或脚本。在这种情况下使用类路径会产生问题。
在空手道配置中,我将变量设置为 application_path,其中包含我在功能文件中引用的绝对路径
空手道配置
{
application_path:"/home/local/IdeaProjects/project/src/test/java/module"
}
谁能帮忙设置或使用绝对路径
当然不推荐这样做,但我们支持绝对路径的 file:
前缀。
请参考文档:https://github.com/intuit/karate#reading-files
* def payload = read('file:/home/foo/bar.json')
我想将所有资源 file/scripts/payload 存储在一个包中,并通过调用函数读取该文件或脚本。在这种情况下使用类路径会产生问题。
在空手道配置中,我将变量设置为 application_path,其中包含我在功能文件中引用的绝对路径
空手道配置
{
application_path:"/home/local/IdeaProjects/project/src/test/java/module"
}
谁能帮忙设置或使用绝对路径
当然不推荐这样做,但我们支持绝对路径的 file:
前缀。
请参考文档:https://github.com/intuit/karate#reading-files
* def payload = read('file:/home/foo/bar.json')