如何在空手道 API 自动化中验证 API 对来自特征文件的多个数据库实例的响应?

How to validate API response against multiple instance of data base from feature file in Karate API automation?

I have developed a script which executes against one DB instance e.g.: db1. The code to connect to DB is written in Background section. Now what i want to do is, i have to execute same test script against diffrent db instance e.g.:db2

Feature:Execution against multiple DB instance.
##############################################
Background:
* def db_properties = {db_username,db_password,db_connection_string,driver}
* def createConnection = path to read .java file
* def readFromDB = new createConnection(db_properties)
##############################################

在 * def db_properties 中,我硬编码了用户名、密码、连接字符串和驱动程序的实际值。我真正想要做的是,我必须验证我的 API 对另一个数据库实例的响应,例如构建部署在另一个环境中,我提到的数据库属性是不同的环境。我该怎么做?

这与空手道无关。也许解决方案是在您的 karate-config.js 中设置 2 组数据库连接值。请找出适合您情况的解决方案。