I've been using HttpUnit to test RESTful webservices in my current project. The library is working great for my purposes especially the ServletUnit extensions for testing my filters and servlets "out-of-container".
I was wondering if there was any interest in making HttpUnit handle non-html response content better? I was surprised, as the project is 'HttpUnit' and not 'HtmlUnit', that the response assumes the content is HTML. I understand that historically HttpUnit was developed for testing web sites and so has only needed to handle HTML. As their are currently very few decent frameworks for testing RESTful web services in Java and HttpUnit's foundation as HTTP rather than just HTML - I think HttpUnit is currently the best fit for the job. It could, with a little work, be an even better fit.
For the purposes of testing RESTful web services xml and json content types are common. As the WebClient assumes the content is HTML I am currently getting the response as a String using getText() and ignoring the noise of the mandatory HTML parser about incorrect syntax.
I am willing to help out moving HttpUnit on in this regard if it aligns with the general goals of the project.
Regards
Grant Forrester
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've been using HttpUnit to test RESTful webservices in my current project. The library is working great for my purposes especially the ServletUnit extensions for testing my filters and servlets "out-of-container".
I was wondering if there was any interest in making HttpUnit handle non-html response content better? I was surprised, as the project is 'HttpUnit' and not 'HtmlUnit', that the response assumes the content is HTML. I understand that historically HttpUnit was developed for testing web sites and so has only needed to handle HTML. As their are currently very few decent frameworks for testing RESTful web services in Java and HttpUnit's foundation as HTTP rather than just HTML - I think HttpUnit is currently the best fit for the job. It could, with a little work, be an even better fit.
For the purposes of testing RESTful web services xml and json content types are common. As the WebClient assumes the content is HTML I am currently getting the response as a String using getText() and ignoring the noise of the mandatory HTML parser about incorrect syntax.
I am willing to help out moving HttpUnit on in this regard if it aligns with the general goals of the project.
Regards
Grant Forrester