views:

167

answers:

2

I am new to testing and mocking. I'm trying to test a business logic class which performs calculations, calls into the DAL and updates the database, and manages transactions. I'm using mocks to do unit testing, but how does full integration testing fit into all of this. Do I basically have the exact same tests, but use the real DAL or do I do something completely different?

+3  A: 

Pretty much. The important thing to know is that unit testing (in TDD) is not much about testing as it's about design. You create unit test to incorporate design decisions of every single component of code in an automated validation system; so that each part of your system conforms to its design. This way, you can rely on each component is not relying on unspecified features of other components.

Mehrdad Afshari
+2  A: 

You can pretty much think of it the way that you are thinking of it. You could add and additional step if you wanted to however and do a process test. In testing you have unit tests, CSC tests, and CSCI tests. You are doing unit tests and CSCI tests. The CSC test is essentially a process test where you would test out the functionality of a process before you put it into the overall application. For example, you have a working application and write a new piece of functionality for that application. You unit test the code first. If everything works then you test the new functionality standalone. If that all works then you put it together with the application and test everything all together.

These can all be the same tests if they cover the functionality. You may need to expand the tests the further you go in the testing though.

Mark