0

This question was asked in a interview. I told that, the application functionality can be tested at unit level via unit testing. To completely test the web application without tomcat or jetty server, the web server behavior has to be simulated.

Is there anyway web application can be tested without web server?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
jaks
  • 4,407
  • 9
  • 53
  • 68

3 Answers3

0

Maybe it can be done by simulating the behaviour of the Web Server through Mock Objects. You can easily done unit testing with tools such as JUnit.

mpampana
  • 166
  • 6
  • Yes. I didnt mention mock above, coz mocking is part of unit testing. Thanks for ensuring – jaks May 26 '14 at 04:34
0

To add to what mpampana said, beyond JUnit, what you need is a mocking framework, not just a unit testing framework. For Java, there are a number of these, such as Mockito, EasyMock, and JMock; see also a more extensive discussion in this question.

This technique is known as dependency injection (see Wikipedia, SO, and Martin Fowler for more info).

Community
  • 1
  • 1
Misha Brukman
  • 12,938
  • 4
  • 61
  • 78
0

You can add - http://www.boutell.com/innards/test_web_applications_without_a_server.html

That is in addition to what you said. The interviewer may ask what will you do if mocking doesn't suffice your needs.

some_other_guy
  • 3,364
  • 4
  • 37
  • 55