Unable to use read('classpath:') when running tests with standalone karate.jar

倾然丶 夕夏残阳落幕 提交于 2019-12-24 06:06:38

问题


I am attempting to execute my tests using the karate stand-alone jar. Throughout my project, I use the read('classpath:') when locating files.

However, when I attempt to execute my tests from the CLI, I receive the following error:

src.test.java.Users.getUser: -unknown-:6 - javascript evaluation failed: read('classpath:commonUtils.feature'), java.io.FileNotFoundException: commonUtils.feature (The system cannot find the file specified) Command: java -jar -Dkarate.config.dir="src/test/java" karate.jar -e DEV -t @tests src/test

It seems that I will have to declare the classpath on execution, would you be able to provide some insight on how to do this please? I'm not sure whether my issue is linked to [karate][standalone] Error : could not find or read file


回答1:


Can you try the ZIP release and if you open the karate batch file you will see this:

java -cp karate.jar:. com.intuit.karate.Main $*

So the trick to setting a custom classpath is to use the com.intuit.karate.Main entry point and in the above example the current dir is also added to the classpath.

It would be great if you try the current RC version (0.9.5.RC3) to ensure we have everything working as expected.

For more information, see this part of the docs: https://github.com/intuit/karate/tree/develop/karate-netty#custom-classpath



来源:https://stackoverflow.com/questions/58398742/unable-to-use-readclasspath-when-running-tests-with-standalone-karate-jar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!