How to execute other directory feature files in karate

☆樱花仙子☆ 提交于 2020-12-26 13:53:59

问题


I had a situation where i am working in home.feature and need to call return.feature and gets the data. And internally return.feature is calling data.feature and collects all the data from it.

Source
 directory1
   home.feature
 directory2
   return.feature
   data.feature

I have written * def response = call read('classpath:source/directory2/return.feature') in home.feature. while calling this line, it is picking up the correct feature file, but while executing return.feature, it throws error while calling data.feature(javascript evaluation failed. java.io.FileNotFoundException).

Please guide what could i do in home.feature file, as i dont have access to change in directory2. Thanks in advance


回答1:


There is a this: prefix: https://github.com/intuit/karate#reading-files

So this should work when you are inside return.feature

* call read('this:data.feature')


来源:https://stackoverflow.com/questions/64028515/how-to-execute-other-directory-feature-files-in-karate

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