I'm just about done creating a web service that will be consumed by a non .NET internal custom system. I would like some advice on the best way to setup test classes and methods over an .asmx (best practices, how to test the calls, what not to do, etc.) specifically in a .NET 3.5 environment.
I will be using NUnit to do this testing. Is it as simple as creating a test project, adding the service to it and then create a test class and instance of that service..then start creating your test methods?
I need to test both the .asmx and .asmx.cs methods (unit test the methods) so that I know if I pass this to a teammate that it's going to work.
Maybe it's not possible to test an .asmx.cs directly and I'll just have to test via integration tests. I guess what I really would need is to mock my .asmx. Probably not possible.
The best practice of a Unit test is not to test the asmx file, but the parts (units) behind the asmx file. If you can split up your code in small and separate pieces, then you can unit test those pieces.
If you want to test the asmx file itself, you're talking about an integration test. You can use NUnit for that in the way you described, but that's not really unit testing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With