2
我想寫如下的jBehave步驟;寫jBehave示例步驟
@When("I perform <someAction> on $panel")
所以我可以有步驟,像
i. When I perform Action1 on Panel1
ii. When I perform Action2 on Panel2
現在你可以看到,這一步有佔位
1. someAction which actually comes via meta
2. $panel which is taken from the step text in the story
的混合但這不是由我的工作和我空指針異常
它的工作原理如果我寫
@When("I perform <someAction> on Panel1")
即我不能在同一步驟中使用2個佔位符。
但由於這是一個通用步驟,我不想硬編碼任何值。
其實我需要2個參數的方法; panelId和someAction – testndtv
@Named參數沒有限制,請檢查http://jbehave.org/reference/stable/parameter-injection.html – RamonBoza