Я пытаюсь создать тест BDD с безмятежностью (бывший thucydides), используя расширение jbehave, это моя история (происходящая из примеров serenity jbehave)
Scenario: a scenario with embedded tables
Given that I sell the following fruit
| fruit | price |
| apples | 5.00 |
| pears | 6.00 |
And I sell the following vegetables
| vegetable | price |
| potatoe | 4.00 |
| carrot | 5.50 |
When I sell fruit
Then the total cost should be total
Examples:
| goods | total |
| apples, carrot | 11.50 |
| apples, pears | 11.00 |
| potatoe, carrot | 9.50 |
Сгенерированный Java-код выглядит следующим образом:
@Given("that I sell the following fruit\r\n| fruit | price |\r\n| apples | 5.00 |\r\n| pears | 6.00 |")
public void givenThatISellTheFollowingFruitFruitPriceApples500Pears600() {
// PENDING
}
@Given("I sell the following vegetables\r\n| vegetable | price |\r\n| potatoe | 4.00 |\r\n| carrot | 5.50 |")
public void givenISellTheFollowingVegetablesVegetablePricePotatoe400Carrot550() {
// PENDING
}
@When("I sell fruit")
public void whenISellFruit() {
}
@Then("the total cost should be total")
public void thenTheTotalCostShouldBeTotal() {
// PENDING
}
Как мне получить аргументы таблицы в моем тесте?
Я попробовал параметры ExamplesTable
в соответствии с документацией по табличным параметрам jbehave, но это не сработало.
Есть ли способ сделать аннотацию given
более читаемой (не добавляя параметры таблицы)?