views:

59

answers:

2

I am trying to test a web service.
My first try was using unit tests which got really complicated because of the need to mock things like HttpContext (that actually was the main reason).
So now I'm trying a different angle - I know I can send a httpRequest using a c# application, but can this application for example maintain the cookies I'll receive from the web service?
Is it a possible and reasonable way to test a web service?

Thank you.

A: 

The logic 'hidden' behind the web service should be testable as unit-tests. The fact the results are returned across the wire is more of an integration test. Maintaining cookies across calls seems like an integration test to me.

BTW, designing stateless web service calls is desireable where possible.

Mitch Wheat
@Mitch: Thanks for the input. I'm really a noob for testing, so it may well be so, but either way - the question remains- How do you test it? It will actually be stateless. But we still need to enable cookies (even if we will not to use them). You can see here as to why: http://stackoverflow.com/questions/3746679/what-do-session-enabling-and-cookieless-have-to-do-with-authentication
Oren A
can you post some of your web service interface definitions?
Mitch Wheat
You mean the web methods' signatures?
Oren A
A: 

Yes, That's possible for every practical use. As for the cookies example, see here.

Oren A