Test Rest Grails Controllers


/ Published in: Groovy
Save to your folder(s)



Copy this code and paste it in your HTML
  1. void testListInXML() {
  2. controller.request.format = 'xml'
  3.  
  4. controller.list()
  5.  
  6. def contact = new XmlParser().parseText(controller.response.getContentAsString())
  7. assert contact.firstname.text() == 'Paul'
  8. assert contact.lastname.text() == 'Bakker'
  9.  
  10. }

URL: http://blogs.infosupport.com/blogs/paul_bakker/archive/2009/08/20/testing-grails-rest-services.aspx

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.