How can we test a WCF service RRS feed

  • Question

  • Hi,

    How can we test a WCF service ?

    Messages, endpoints, bindings,…. ?


    I create a Unit Test Projet to test class libraries, but How can we test a WCF service ?

    Best regards


    Monday, January 30, 2012 4:22 PM


  • Gophette,

    There are a lot of ways to test a WCF service...

    - One of the most basic test is to run your service library in Visual Studio, VS automatically creates a test client for you

    - In you unit test project you can initialize a proxy that calls your service and evaluate the response

    - A good practice (in my opinion) is to create a simple test client that can test your service. I do this for 3 reasons:

    1. To test the service from remote machines
    2. To test more complex security setups (you might not need this)
    3. You have an example/sample ready at all times to hand out to developers that need to consume your service. That avoides a lot of 'how to?' questions that you need to answer :)

    - If you want to 'load test' your service you can do that with VS or thirt party tools like SOAPUI.

    Another tip; when testing enable WCF tracing (events and message bodies) and check whether what you see is what you expected...


    If this post answers your quenstion, please mark it as such. If this post is helpful, click 'Vote as helpful'.
    • Marked as answer by Yi-Lun Luo Friday, February 17, 2012 8:03 AM
    Monday, January 30, 2012 5:46 PM