WCF Test Client

WCF Test Client is a debugging tool for WCF services. Learn how to start the WCF Test Client and how to use WCF Test Client.

What is WCF Test Client?

 
WCF Test Client is a debugging tool for WCF services. Those who are not interested in creating a Console application or a website to test the service can use this tool. Using this tool we can test a single service or multiple services. We can also open multiple instances of the tool. MSDN has a good definition of WCF Test Client.
 
"Windows Communication Foundation (WCF) Test Client (WcfTestClient.exe) is a GUI tool that enables users to input test parameters, submit that input to the service, and view the response that the service sends back. It provides a seamless service testing experience when combined with WCF Service Host.".
 

How to start the WCF Test Client?

  1. Open the folder "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE" and double-click on WcfTestClient.exe. If you have a 64 bit OS then look in the "Program Files (x86)" folder.

    WCFTst1.jpg
     
  2. From the command prompt we can open the tool by passing the service URI as a command argument.

    WCFTst2.jpg
     
  3. Another way is, once we create a new WCF Service project and hit F5 to start the debugger, the WCF service will be hosted and the WCF Test Client opens the display.

    WCFTst3.jpg
If we are running the tool directly from a project then the builtin tool will be launched and the service will be added automatically.
 
WCFTst4.jpg

But if we are doing it manually, then we must add the service to the client by right-clicking on "My Service Projects" and "Add Service".
 
WCFTst5.jpg
 
WCFTst6.jpg 
 
Once configured, the tool will list all the methods and configure the info from our service as below, here we list the methods from the article or example given by Dhananjay Kumar.
 
 
WCFTst7.jpg 
 
Double-click on each method; on the right pane we will see the Request and Response tab. The Request tab accepts the various input parameters even with the data type and input parameter name. The Response tab will show the result formatted or in a valid XML format. Let's do a small test by calling the method AddNumbers().
 
WCFTst8.jpg
 
WCFTst9.jpg 
 
We added some input value above and after clicking on "Invoke" the output is generated even in XML format. The best part of the tool is that also it validates the data types. If I enter an invalid data type then the tool will throw an error.
 
WCFTst10.jpg 
 
Anyone looking for a free tool with more features than WCF Text Client, the best one is STORM.
 
Thank You!