I am learning Cucumber for unit testing and was trying to write unit tests for the Radix Sort code. But I am unable to figure out how to provide array of integers as an input to radix sort code from feature file.
I tried providing below input:
Scenario: Sorting integer array using radix sort within the specified range
Given The nonnull integer array 10,25,0,1
When radix sort is performed over the range from 0 to 7
Then validate if the array is sorted
For the above scenario cucumber expects below-mentioned code body:
@Given("The nonnull integer array {double}")
public void the_nonnull_integer_array(Double double1) {
// Write code here that turns the phrase above into concrete actions
throw new io.cucumber.java.PendingException();
}
If I try giving input as
Scenario: Sorting integer array using radix sort within the specified range
Given The nonnull integer array [10,25,0,1]
When radix sort is performed over the range from 0 to 7
Then validate if the array is sorted
then cucumber expects below-mentioned code body:
@Given("The nonnull integer array [{double}]")
public void the_nonnull_integer_array(Double double1) {
// Write code here that turns the phrase above into concrete actions
throw new io.cucumber.java.PendingException();
}
I also tried providing array within quotes
Scenario: Sorting integer array using radix sort within the specified range
Given The nonnull integer array "[10,25,0,1]"
When radix sort is performed over the range from 0 to 7
Then validate if the array is sorted
But then cucumber expects String as an input
@Given("The nonnull integer array {string}")
public void the_nonnull_integer_array(String string) {
// Write code here that turns the phrase above into concrete actions
throw new io.cucumber.java.PendingException();
}
I tried various other ways without any success. Can anyone suggest any better approach on handling such testing scenario?