yourbuddypal
yourbuddypal

Reputation: 543

WCF - Testing a Referenced 3rd party Service

I've been trying to do some research on this topic as I assume this scenario occurs frequently, but I haven't found anything too relevant. We have a 3rd party service from our client that we interact with. We have their WSDLs, have made service references and developed our side of the project, but we do NOT actually have access to their services for testing. What is the best way to go about testing our code? Here are the options I am aware of:

  1. Soap UI - This tool allows you to create Mock Services from a WSDL. You can specify reply messages that will be returned for different method invocations, but as far as I am aware, it is entirely random which reply will be used.
  2. Manually Created Mock Service - I found that I needed more control over the test service. Specifically, I wanted to do input validation and return the proper data. Therefore, I built my own mock service that extends a service interface that I generated from the client's WSDL using the /serverInterface from the WSDl.exe tool.

Is there a better way to do this kind of testing? I felt very limited by option 1, but option 2 seems kind of intensive. My coworker has scoffed at option 2 because of the amount of work, and has mentioned that we should be using Visual Studio to perform testing. Does such a testing tool in visual studio exist? If so, would it be limited in the same way as Soap UI, where we would be subject to duplicate reply messages?

Thanks!

Update: To clarify, regarding the Visual Studio testing questions: I know that there is a test suite in VS and there are things like web tests, but what about a mock service? I havent seen anything to indicate the existence of this kind of testing tool.

Upvotes: 2

Views: 289

Answers (1)

kroonwijk
kroonwijk

Reputation: 8400

We have multiple mockups running using your option 2. Indeed it takes some work to mimic the operational behavior of an external service, but it pays back tremendously. You have complete control over the test implementation and can control which answer to return on which question.

Important to have is a good description of the behavior of the service from the 3rd party. The interface description is often to little detailed. What errors can get returned? When do errors occur? What is the happy path. All should be known. So as a side effect of creating the mockup, you get an expert insight in the functioning of the 3rd party service :-)

Upvotes: 1

Related Questions