0

I am wondering if there is a way to access the code of the Java WS application. I would like to find an alternative method of application automation (directly calling procedures and passing parameters) instead of using some external UI automation software. Does anybody have any thought? or this is a bad idea to go this way?

vlad.lisnyi
  • 325
  • 2
  • 12

1 Answers1

0

Well, Server-Side code, e.g. WebService/Servlets, etc, are meant to be deployed to a web container, and accessed and tested by external applications.

However, usually you can write JUnit tests mocking the application server objects, e.g. HttpServletRequest, HttpSession by libraries like mockito or EasyMock. Mocking can go all the way to simulate values from database, server-parameters, potentially all dependencies of your test code.

Sometimes, you can also write JUnit tests with Java Reflection, to ensure correct values of Annotations, to test something like:

@WebService(name = "myWebService",  serviceName = "SomekWebService", 
    portName = "AnotherWebServicePort", targetNamespace = "http://www.mine.com/ws/hello")

Usually, a project has both simple JUnit tests if possible, but also full integration tests with running on the server, in cases you need to get actual values.

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56