How to write scenario outline to capture list of object in a single argument?

Viewed 5173

When writing cucumber scenario outline test cases, sometimes i have requirement that i need one of the placeholder to hold a list of data instead of one. See below pseudo example:

Scenario Outline: example
Given I have <input_1> 
When I choose <input_2>
Then I should receive <result_list>  //instead of a single result

Examples:
| input_1        | input_2        | result                 |
| input_1_case_1 | input_2_case_1 | result_1_case_1_part_1 |
|                |                | result_1_case_1_part_2 |
|                |                | result_1_case_1_part_3 |

In the above example, my "result" need to capture a list of object for each single input_1 and input_2 parameter. But with the above writing, cucumber will not compile the last statement to something like:

@Then("....")
public void i_should_receive(Datatable or list of object) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

How can write my cucumber script to achieve what i want?

Thanks.

2 Answers
Related