I need to do some functional testing on a component that exposes a small set of WCF endpoints. I'm still ramping up on WCF, so I'm hitting a bit of analysis paralysis trying to figure out the best way to test this. In doing some research, most articles approach this from a unit testing standpoint. I've seen some people say to completely avoid the WCF plumbing and just test the interface implementation directly, which seems more like unit testing to me. Others recommend to have the test case(s) use WCF self hosting and make the calls. Any guidance or wisdom on testing APIs that are exposed as WCF?

3 Answers 3


There are two approaches that I have taken to testing a WCF service. I am working under the assumption that you are looking to simulate the configuration both hosting and access that an application would do from a production set up. Hosting it I would set it up in a similar maner to what you are planning to do when deployed. For me this meant deployng it to a server and the hosting was done either though IIS or as a windows service deployment .

Once this is done it sort of depended on what I was trying to accomplish. If I just wanted to do some quick and dirty testing of the service I used the WCF Test Client. This allows me to simply pass input values to the available methods and look at the return values. If I was writing automation I simply started a new project in VS and added the hosted service as a reference and started writing my code against the exposed interface. Hope this helps

  • Based on your first paragraph, it makes sense to host the service in IIS as we do in production and test against that. Thanks! Commented Jun 8, 2011 at 16:01
  • Just as a follow up, I decided to host the service in IISExpress. This made the test deployment model really easy and portable. One of the gotchas is that IISExpress only supports http/https bindings, so this won't work if you need to test other bindings like net.tcp. Commented Jun 17, 2011 at 3:35

I use SOAP UI for this. It automaticaly generates all the functional test cases, based on wsdl definition, it is possible to load test your service, it is free and open source (and there is commercial version), etc.


  • Thanks Nikita. I briefly looked into this and it's not exactly what I'm looking for. I'm looking more for approaches/methodologies for structuring or architecting my automated testing. I'm currently going the self-hosting route for now, but I'll continue to look into SOAP UI. Thanks! Commented Jun 7, 2011 at 1:56
  • @Nikita, just to clarify: SOAP UI, creates templates for a functional test case, not test cases themselves.
    – dzieciou
    Commented Apr 13, 2013 at 7:34

Below options are also a possible solution:

  1. Generate a client proxy class for the WCF Web service

  2. Using VSTT - Data Driven Test Approach for running tests with different test data

  3. For .NET 2.0 testing I have used VSTT for web service testing. It is pretty simple. See Creating a Data-Driven Web Test against a Web Service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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