Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Most of the logic for my webservice involves talking to our suppliers webservices. (checking availability ordering ect) They dont have a test environment and the majority of calls cant be run arbitrarily (for example a cease would be run once and would actually stop a service).

Is it feasable to run unit tests in this environment? I could simulte typical responses but im worried that hardcoding supplier responses would undermine the point of unit tests.

share|improve this question
add comment

3 Answers 3

up vote 25 down vote accepted

No, it won't. The point of unit tests is precisely to test your code in isolation, independent of the external world.

Testing your whole system interacting with external parties like web services etc. is integration/system testing. This is also needed in most to all real world projects, but it is a different level than unit tests. Actually it sounds like in your situation, since you have difficulties in integration testing, you need unit tests even more than usual.

As a long term goal, you may consider educating and/or pestering said suppliers to set up a test environment for themselves and their clients. You may need to invoke your management's support for this to succeed though, so get prepared with hard facts and figures to convince them about the business value of a test environment.

share|improve this answer
7  
+1: "you need unit tests even more than usual". And you need to accurately mock the supplier request/response, timeout, error, bad credentials and all the other little things that cause "problems" in an application like this. –  S.Lott Sep 9 '11 at 10:26
add comment

Unit testing will also provide you with an unambiguous, executable specification of the behavior you expect from your suppliers. This will probably make communicating with them much easier.

If there is some problem in the interaction between your and theirs, you can provide them with your unit tests to clearly state what behavior your code expects. If their code does not behavior the same way your unit tests do, the differences are usually easy to spot.

share|improve this answer
    
Such tests are indeed useful, but the widely used terminology for these is system / acceptance tests rather than unit tests. –  Péter Török Sep 9 '11 at 12:28
    
@Josh Peterson I have had complaints from their "developers" before because I just sent them xml rather than explaing the xml content. I think unit tests wouldent get me very far :) –  Tom Squires Sep 9 '11 at 16:43
add comment

ROI

This is really an Return On Investment question. Do you feel that investing in unit tests is worth what you will get back. Namely, your code tested in isolation. As well as all the other benefits of unit testing.

You can contrast this with say an automated acceptance test approach where you would get a test account from your supplier actually test the integrated system with the tests. Is the cost of doing ATDD worth what you get back. Namely, testing of the system as a whole.

It's up to you to do the analysis and figure if you should do unit testing, automated acceptance testing, both, neither, or something else.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.