@RequestMapping(method=RequestMethod.POST, value="/employeeXML")
public ModelAndView addEmployeePostXMl(@RequestBody String body) {
Source source = new StreamSource(new StringReader(body));
Employee e = (Employee) jaxb2Mashaller.unmarshal(source);
employeeDS.add(e);
List<Employee> employees = employeeDS.getAll();
EmployeeList list = new EmployeeList(employees);
return new ModelAndView(XML_VIEW_NAME, "employees", list);
}
I am able to test it for single POST body ie
<employee>
<id>3</id>
<name>guest3</name>
<email>guest3@ibm.com</email>
</employee>.
But how to check it for multiple DYNAMIC values like CSV files.If i am using csv file with data :
3 aFFaFD xfchghcxh
4 dsfgsdF cxhchcxht
5 asFDdsF chcxhcg
6 sdFsF cxhxhcgh
7 SDFsF cghcxhcg
8 gfzsgzd cxghchc
9 hgfxhfx cghchgc
10 fghxf ghcxhxc
11 fhgfxh cghchcc
12 ghcxxh cxhcghch
13 chgxgcvx cghchcxgch
14 hgxfhxch cxhgxchcg
15 ghcxhcx vmcvmnvbm
16 cghch bnmvmbh
17 cxghcxhcx mvbhgn
18 cxghcxh mnmcghmh
19 cxghcxhxch mnvmvmcv
20 xcghchcx mvcmvmv
it gives unmarshalling exception because the post body should be in XML format.
Try to use JMeterRestSampler – custom jmeter sampler for testing REST services:
You can use it along with the following schema:
Thread Group . . . While Controller Condition: ${__javaScript("${email}"!="<EOF>",)} // until the EOF CSV Data Set Config Filename: [path to your file with test-data] Variable Names: id,name,email REST Sampler