[英]KARATE - How to get data from response/by running another feature file
我有一個功能文件,該文件連接到oracle數據庫並獲取數據並作為響應進行打印。 以下是示例代碼。
dbconnect.feature
def queryDATA = 'QueryData'
When def db = DBConnect.queryDB(host, port, serviceName, username, password, queryDATA)
Then print db
***請注意,在此之前我還有幾行代碼,這些代碼設置了jdbc並使用適當的憑據連接到DB
發布此消息后,我需要運行真實的測試用例,而該用例又應調用dbconnect.feature來獲取數據並提供給請求。 像這樣;
UserDetails.feature
Background:
* url 'https://soaheader-env-name.com'
* header agent_uid = 'AUTO_TST'
* configure ssl = true
* header Authorization = call read('classpath:ABC/JSFiles/auth.js') {
username: 'XYZ', password: '123' }
* configure logPrettyResponse = true
* configure logPrettyRequest = true
@UserDetails
Scenario Outline: Get User Details
Given path 'somefooterurl/account/<accountno>/user-details-summary'
When method get
Then status 200
Then match response contains 'OK'
我確實需要使用dbconnect.feature中的數據並在UserDetails.feature請求中提供。
請提出一種方法/幫助我在karate-github中找到正確的路徑。
一個簡單的例子,
* def dbCall = call read('dbconnect.feature')
* def db = dbCall.db
請參閱空手道說明文件
如果要將值傳遞給功能部件,請參考其他參考:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.