Unit testing a Sling Servlet | Community
Skip to main content
sutty1000
January 6, 2017
Solved

Unit testing a Sling Servlet

  • January 6, 2017
  • 2 replies
  • 2037 views

I'm trying to unit test my class that extends the SlingAllMethodsServlet class and having a hard time! I want to check the result of my doGet method (which has a void return type) I need to check what has been written into the PrintWriter does anybody have experience trying to do this?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

See this GEMS Session - it looks like it will help. 

From Unit Testing to Integration Test of an Experience Manager Application

Automated testing is indispensable for developing any application. This presentation walks through the various tools for testing Java code starting with the basics of unit testing up to functional and integration testing. Learn how to easily add tests in the most effective way to your code base, regardless of whether you want to test a simple utility method, some OSGi service, or an HTTP endpoint.

2 replies

smacdonald2008
smacdonald2008Accepted solution
January 6, 2017

See this GEMS Session - it looks like it will help. 

From Unit Testing to Integration Test of an Experience Manager Application

Automated testing is indispensable for developing any application. This presentation walks through the various tools for testing Java code starting with the basics of unit testing up to functional and integration testing. Learn how to easily add tests in the most effective way to your code base, regardless of whether you want to test a simple utility method, some OSGi service, or an HTTP endpoint.

December 16, 2021

Hi @smacdonald2008 I cannot find this session on the link written here.

sutty1000
sutty1000Author
January 6, 2017

Great thanks, looks like it will be exactly what I'm after! :)