# use jdbc to validate
* def config = { username: 'sa', password: '', url: 'jdbc:h2:mem:testdb', driverClassName: 'org.h2.Driver' }
* def DbUtils = Java.type('com.intuit.karate.demo.util.DbUtils')
* def db = new DbUtils(config)
# since the DbUtils returns a Java Map, it becomes normal JSON here !
# which means that you can use the full power of Karate's 'match' syntax
* def dogs = db.readRows('SELECT * FROM DOGS')
* match dogs contains { ID: '#(id)', NAME: 'Scooby' }
1条答案
按热度按时间w80xi6nr1#
空手道支持任何java代码,这样你就可以做任何你想做的事情。
请看这个jdbc示例,它将帮助您开始:
dogs.feature
. 你将需要写一点java代码(只写一次),所以如果你没有这个技能,请找人帮忙。