亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 Cucumber v1.2.4 時運行 Cucumber 測試的方法沒有簽名

使用 Cucumber v1.2.4 時運行 Cucumber 測試的方法沒有簽名

墨色風雨 2023-03-23 16:15:58
我在設置自己的開發環境時遇到問題。我正在使用 eclipse phontom 和eclipse-groovy,Cucumber Eclipse plugin并想加入使用 groovy 和 cucumber 編寫測試代碼的開發。起初我io.cucumber.cucumber-groovy:4.5.3通過 maven 導入 cucumber ( ) 的依賴項,一切正常。然而,幾天后,同事告訴我,他們過去常常使用舊版本(info.cukes.cucumber-groovy:1.2.4)導入依賴項。降級后我的筆記本電腦里的一切都壞了。例如,以下是 的簡單步驟定義Given。package stepsimport cucumber.api.groovy.ENimport cucumber.api.groovy.Hooksthis.metaClass.mixin(EN)this.metaClass.mixin(Hooks)Given(/an item ID which does not exist/) { ->    documentId = "test_not_exist_" + UUID.randomUUID().toString()}當我在筆記本電腦上運行它時,會引發以下異常。No signature of method: steps.RawItemRetrieval.Given() is applicable for argument types: (java.lang.String, steps.RawItemRetrieval$_run_closure1) values: [an item ID which does not exist, steps.RawItemRetrieval$_run_closure1@45d2ade3]Possible solutions: grep(), run(), run(), find(), every()    at cucumber.runtime.groovy.GroovyBackend.loadGlue(GroovyBackend.java:85)    at cucumber.runtime.Runtime.<init>(Runtime.java:91)    at cucumber.runtime.Runtime.<init>(Runtime.java:69)    at cucumber.runtime.Runtime.<init>(Runtime.java:65)    at cucumber.api.cli.Main.run(Main.java:35)    at cucumber.api.cli.Main.main(Main.java:18)我應該做些什么來使事情在依賴性下工作info.cukes.cucumber-groovy:1.2.4?以下是我的可能相關的開發環境:JDK: Amazon Corretto-8.212.04.2 (build 1.8.0_212-b04)Maven: 3.3.9Groovy compiler in eclipse: 2.4.17任何建議,將不勝感激。謝謝!
查看完整描述

1 回答

?
楊__羊羊

TA貢獻1943條經驗 獲得超7個贊

好的,我想我已經找到原因了。可能是cucumber 1.2.4不支持如下格式的步驟定義導致的:

Given(/an item ID which does not exist/) { ->
    ....
}

當我將樣式更改為正則表達式格式時,它再次起作用。

Given(~/^an item ID which does not exist$/) { ->
    ....
}

感謝 Mark Rotteveel 的建議!


查看完整回答
反對 回復 2023-03-23
  • 1 回答
  • 0 關注
  • 139 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號