Getting started with integration testing
I learned nothing about testing during my 3 years of computer engineering. We were mostly just told that it was very important.
Anyways, I managed to get started with Unit Testing on my own to a talk by Roy Osherove and his book The Art of Unit Testing. Very helpful, clear and to the point.
Problem now is that there of course are a lot of code that requires for example databases or web services. I can mock these take them out of the equation which is good for unit tests, but it does leave quite a bit of my code untested. Are there any good books or resources that are up to date, with very little fluff, which can help me 开发者_StackOverflow社区get started with integration tests? Preferably with focus on C#.
I am reading this Manning book Continuous Integration in .NET
One book that I read that helped me out on the path of integration testing was Continuous Integration: Improving Software Quality and Reducing Risk
This book did not have a primary focus on .NET but did offer a valuable resource in the whole process of continuous integration.
In respect to integration testing (which is a part of continuous integration) the book covers some aspects of the process of building up a database, going over frameworks to help you seed data, and wrapping that up nicely in a build script (the book uses Nant)
Here is an interesting analogy: http://osherove.com/blog/2008/5/31/unit-testing-vs-integration-testing-the-restaurant-analogy.html
If you design your tests the way it should be designed, the service and the caller both will be tested. You don't need Integration Testing for Client/Webservice test. You should create a test for the caller, and another one for the service. This ensures that both will be tested. However, sometime you need to test directly with the database, (for example, to test your repository classes), in this case, you should do an integration testing, on a real database.
精彩评论