When I run the POST call through Rest assured framework(Cucumber Examples keyword), first dataset requests run fine but with the second dataset, both first dataset and second dataset values are getting merged. How can this be rectified?
Featurefile:
Given profile details with "name" and "profiletype"
Examples: | name | profiletype |
| Davian | ADULT |
| Kavian | ADULT |
Stepdefinition:
public void profile_details_with_and(String name, String profiletype) throws IOException {
config.setProperty("Base.properties");
testservice.setBaseURI();
testservice.addQueryParam("at", config.getConfig().getProperty("at"));
testservice.addHeaderCookie("COOKIE",config.getConfig().getProperty("COOKIE"));
testservice.callRequestSpec();
testservice.formParam("profilePic","default");
testservice.formParam("locale","en");
testservice.formParam("name",name);
testservice.formParam("profileType",profiletype);
}
public void formParam(String key, String value) throws IOException{
requestSpec = given().spec(setBaseURI()).contentType(ContentType.URLENC.withCharset("UTF-8")).formParam(key, value);
}
Logs Output:
Form params:
profilePic=[default, default]
locale=[en, en]
name=[Davian, Kavian]
profileType=[ADULT, ADULT]