我只想在满足特定条件时执行某个步骤。 例如,
给出天和月年的列表
如果列表包含 30 天的月份,则
当用户输入 31 表示每月 30 天 然后显示的错误消息是“无效日期”
JBehave故事中可以写If条件吗?
我认为您不需要“给定/何时/那么”模式中的 IF。 在您的示例中,“如果列表包含 30 天的月份”可以被视为“如果用户选择有 30 天的月份”。
所以,你的例子可能会这样写:
Given a lists of days and MonthYear
When the user enters 31 in days AND user choose a month with 30 days
Then the error message shown is 'Invalid date'