Reputation: 43
I am using serenitybdd to load the data from csv file but my code is unable to fetch the values from csv . Its showing null values for both xyz and abc when i am trying to print in @test metho i_setup_the_request_fields() below. What did i do wrong here?
Here is the code of java and csv file.
@RunWith(SerenityParameterizedRunner.class)
@UseTestDataFrom(value="template/test/data/response/test.csv")
public class TestCustomSteps {
private String abc;
private String xyz;
@Steps
RestAssuredSteps restAssuredSteps;
public void setAbc(String abc) {
this.abc = abc;
}
public void setXyz(String xyz) {
this.xyz = xyz;
}
@Qualifier
public String qualifier() {
return abc + "=>" + xyz;
}
@Test
@Given("I setup the request fields")
public void i_setup_the_request_fields() {
// Write code here that turns the phrase above into concrete actions
System.out.println(abc+"--"+xyz);
Map<String,String> mapData = new HashMap();
mapData.put("abc",abc);
mapData.put("xyz",xyz);
restAssuredSteps.setRequestFields(mapData);
}
}
and csv file
abc,xyz 6543210987654321,10000 6543210987654320,10000
Upvotes: 0
Views: 1016
Reputation: 450
A few things you can try one at a time:
Try changing your variable names to cloakPan and memberId or change your setter methods to match your variable names.
Maybe hard-code the full path to the file name (from root) just to make sure it is looking in the right place.
Upvotes: 0