|
Project Information
Members
Links
|
Smock simplifies your SOAP Web Service tests. You can use it if you need to
Although Smock builds on Spring WS 2.0 testing framework it can be used to test other SOAP stacks in similar way. I would really like to hear your feedback. If you have anything to tell me, please contact me on smock-info@googlegroups.com (Google group) Server testIf you want to test your WS server code, you can use following code @Test
public void testCompare() throws Exception {
client.sendRequest(withMessage("request1.xml")).andExpect(message("response1.xml"));
}
@Test
public void testValidateResponse() throws Exception {
client.sendRequest(withMessage("request1.xml")).andExpect(noFault()).andExpect(validPayload(resource("xsd/calc.xsd")));
}Client testsTo test your client code you can do the following @Test
public void testSimple()
{
mockServer.expect(anything()).andRespond(withMessage("response1.xml"));
int result = calc.plus(1, 2);
assertEquals(3, result);
}
@Test
public void testVerifyRequest()
{
mockServer.expect(message("request1.xml")).andRespond(withMessage("response1.xml"));
int result = calc.plus(1, 2);
assertEquals(3, result);
}You can start by reading CommonFeatures and then you can follow to specific setting for you SOAP stack. |