Alex Rivera | Logout

Should we unit test web service?

Asked 2009-08-20T20:15:37.670
13

Should we unit test web service or really be looking to unit test the code that the web service is invoking for us and leave the web service alone or at least until integration testing, etc.... ?

EDIT: Further clarification / thought

My thought is that testing the web service is really integration testing not unit testing?? I ask because our web service at this point (under development) is coded in such a way there is no way to unit test the code it is invoking. So I am wondering if it is worth while / smart to refactor it now in order to be able to unit test the code free of the web service? I would like to know the general consensus on if it's that important to separate the two or if it's really OK to unit test the web service and call it good/wise.

If I separate them I would look to test both but I am just not sure if separation is worth it. My hunch is that I should.

Edit
Report

2 Answers

5

Why not do both? You can unit test the web service code, as well as unit test it from the point of view of a client of the web service.

answered 2009-08-20T20:33:11.177
2

We do both.

We unit test the various code elements.

Plus, we use the unit test framework to execute tests against the web service as a whole. This is rather complex because we have to create (and load) a database, start a server, and then execute requests against that server.

answered 2009-08-20T20:55:54.763

Your Answer