當前正在實施GEB,Spock和Groovy。我碰到類似如何搜索並返回值並將其傳遞給spock表中的方法
spock表中有一組數據。我必須將modulename作爲參數傳遞,從spock表中搜索,然後返回兩個值用戶標識和密碼。下面的代碼是骨架代碼
我的問題是如何根據參數搜索模塊名? 如何返回兩個數據?
Class Password_Collection extends Specification {
def "Secure password for search and Data Driven"(String ModuleName) {
expect:
// Search based on modulename in where
// pick the values and return the picked data
where:
Module | User_Name | Pass_word
login_Pass | cqauthor1 | SGVsbG8gV29ybGQ =
AuthorPageTest_Pass | cqauthor2 | DOIaRTd35f3y4De =
PublisherPage_pass | cqaauthor3 | iFK95JKasdfdO5 ==
}
}
如果你提供了代碼,這將是很大的幫助學習和imeplement。
場景是:傳遞模塊名稱,它將在匹配的where塊中進行搜索,應該捕獲user_name和pass_word並返回到另一個方法/類的密碼將被解密,並且userid和password會將它發送到另一個模塊憑據。但是在代碼中,它返回true或者通過。 –
請根據以上情況糾正我下面的代碼。類PasswordCollection延伸規格{ DEF 「安全密碼數據驅動」(字符串的關鍵字){ 期望: 如果(關鍵字==模塊) 返回encryptPassPass_word 其中: 模塊| User_Name |密碼 –