从空手道DSL中的.properties文件读取数据 [英] Reading data from .properties file in Karate DSL

查看:69
本文介绍了从空手道DSL中的.properties文件读取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正试图与另一个使用Webdriver等的Java项目共存.作为其一部分,我们想重新使用其他项目用于配置等的.properties文件.能否有人指导我们从空手道DSL中的.properties文件读取数据.

We are trying to co exist with another java project which uses Webdriver etc. As part of this we would like to re use the same .properties file that is being used by other project for our configuration etc. Could some one guide us on reading from .properties file in Karate DSL.

推荐答案

空手道没有内置的功能-但您的解决方案很明确,编写一个简单的Java实用程序以读取属性文件-或因为它是如此简单,即使在JS中,您也应该能够在 karate-config.js 本身中做到这一点.

There is nothing built in to Karate - but the solution for you is clear, write a simple Java utility to read a properties file - or since it is so simple, you should be able to do this even in JS, in the karate-config.js itself.

,也请参考以下内容: https://github.com/intuit/karate#calling-Java

And also refer this: https://github.com/intuit/karate#calling-java

我还没有测试下面的代码,但是您知道了:

I haven't tested the below code, but you get the idea:

* def stream = read('classpath:myfile.properties')
* def props = new java.util.Properties()
* eval props.load(stream)

这篇关于从空手道DSL中的.properties文件读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆