• Post Reply Bookmark Topic Watch Topic
  • New Topic

ajax app - testing xml post  RSS feed

 
Mark Lybarger
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we have an ajax type of client application that submits some xml to a servlet for processing. the servlet can respond with typically some further xml data. i want to test the server side of things. i've used httpunit, cactus and jmeter in the past, but these seem more focused on the traditional form submit.

how can i test the submit of xml data to a servlet?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you struggling with? Writing asserts against the XML? Or something else?
 
Mark Lybarger
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm struggling with which framework will allow me to attach xml to the body of an http request or submit, and how that would work (examples). looking at the HttpUnit, i can set form variables, and post the form. I haven't really done much cactus testing of servlets, i've only used it extensively to test EJB's.
The servlet code typically does the following to get the input xml data that is sent by the XMLHttpRequest javascript object:

BufferedReader br = request.getReader();
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you want to test the XML processing in the servlet?

In that case, the most important step is probably to decouple the XML processing from the servlet logic and test it seperately.

But I'm still not fully sure about what you really want to do. Sorry...
 
Mark Lybarger
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, i ultimately want to test the xml processing of the servlet. and i want to do it in an integrated manner (in container testing). part of the xml processing is calling out to an external service and getting some more xml and assembling the results, and returning more xml. similar to a session facade bean that calls other beans to do it's work. we are segrating the processing from the servlet itself, but the best way to do end to end testing is to test sending the xml to the servlet and verifying the resultant xml.

thus, my question is, what testing framework can easily allow me to post xml to a servlet as the body of the xml message, and verify the results?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!