J如果有条件就讲故事

问题描述 投票:0回答:1

我只想在满足特定条件时执行某个步骤。 例如,

给出天和月年的列表

如果列表包含 30 天的月份,则

当用户输入 31 表示每月 30 天 然后显示的错误消息是“无效日期”

JBehave故事中可以写If条件吗?

automated-tests jbehave
1个回答
1
投票

我认为您不需要“给定/何时/那么”模式中的 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'
© www.soinside.com 2019 - 2024. All rights reserved.