What's the best way to test WCF services?

Viewed 86231

I've used this tool that microsoft ships with visual studio because it's quick and dirty

http://msdn.microsoft.com/en-us/library/bb552364.aspx

But it's kinda clunky and hard to work with. Are there any other useful test clients out there that you use and don't require creating a new visual studio project and compiling code?

EDIT: I'm looking more for a graphical test tool that I can use to do quick ad-hoc tests of systems in our different environments without having to write a bunch different tests.

10 Answers

SoapUI is another web service testing tool. I strongly recommend it.

You're not going to find any better tool for creating automated tests of WCF servcies than to use your favorite unit test framework and write tests. The test client, nor soapUI will create a test that can run in a Continuous Integration scenario.

Well I end up writing unit tests in MS test. Before each test the service is hosted by the test assembly, and ripped down afterwards. Sure it's not unit testing, so purists will shudder, but it does mean I can run tests as often as I like.

I didn't mean to imply that soapUI does not work for a WCF service exposed using basicHttpBinding. Using basicHttpBinding would work because the service would be functioning as a legaxy ASMX web service. However, if one is to switch the binding (or use multiple bindings) to netTcpBinding for example, i dont think it would still be possible to invoke the methods of that service using soapUI. The scenario I'm describing is quite common wherein you have a WCF service exposed on the web using basicHttpBinding endpoint for maximum interoperability, and another endpoint as netTcpBinding(for max performance) used only internally.

There is this new test client called SOA Cleaner, I recommend you try it. It supports WCF. can be found at: http://xyrow.com.

If you need to test the client logic: You can use mocking/Isolation framework to stub the actual calls to the server and use a unit testing framework to write proper Unit Tests.

Testing the server logic can be even easier - all you need is to test the call to the business logic and stub calls to external components (i.e. database).

There is no actual benefit of unit testing the full interaction between the client to the server because you know that WCF works instead add integration testing of the entire environment on a dedicated server/clients.

Related