Testing WCF service using Test Client (wcftestclient.exe)


Windows Communication Foundation (WCF) Test Client (wcftestclient.exe) is one of the best GUI tools supplied by Microsoft to test WCF services, from loading the service, passing inputs to the service and viewing all the responses sent by the services.  The best thing about this tool is that we don't need to create a client application to test our services.

The following is a step by step process to use the wcfclient.exe tool.

Step 1. Create a WCF service.

Step 2. Now it's time to test our service. Instead of creating a console application or a client application to test the service we will use the predefined tool wcftestclient.exe.

Step 3. Open Visual Studio command prompt and type wcftestclient then Enter. 

wcftestclient1.gif
 
Step 4. After pressing Enter, we get a GUI application of the WCF Test Client.

wcftestclient2.gif
 
Step 5. Select File->Add Service and type the service endpoint url as address and click ok.

wcftestclient3.gif
 
We get as below

wcftestclient4.gif
 
Step 6.  Double click on Greeting Method

wcftestclient5.gif
 
Step 7. Now pass the value and click on Invoke button and you will get the response below.

wcftestclient6.gif 

Or you can simply run the WCF service application; it will load your application to Test Client.