I'm fairly new to test-driven development and have decided it is the best way to go for my new webapp. While functional tests with selenium seem to be more straightforward (as far as what the tests want to accomplish), I'm lost on what unit tests for the database should test for.
For example, if I have a database table with columns id, 'dogowner', and 'dogname', and have a controller returning a dict with 'dogowners', what should I be testing in the unit tests for the database and controller?
The database table will be fixed with a limited number of 'dogowner' entries, about 10, so should I be testing whether the database has 10 entries, and if the len of the dict returned by the controller is 10? This datatable may not be fixed in the future, so what functionality of the database would I be testing for?
I'm following http://www.web2py.com/AlterEgo/default/show/260 , but while that page explains HOW to go about unit testing, it doesn't explain what I should be testing for. Anyone experienced with TDD in web2py want to point me in the right direction? Thanks in advance!
--
I'm following http://www.web2py.com/AlterEgo/default/show/260
I'm fairly new to test-driven development and have decided it is the best way to go for my new webapp. While functional tests with selenium seem to be more straightforward (as far as what the tests want to accomplish), I'm lost on what unit tests for the database should test for.
For example, if I have a database table with columns id, 'dogowner', and 'dogname', and have a controller returning a dict with 'dogowners', what should I be testing in the unit tests for the database and controller?
The database table will be fixed with a limited number of 'dogowner' entries, about 10, so should I be testing whether the database has 10 entries, and if the len of the dict returned by the controller is 10? This datatable may not be fixed in the future, so what functionality of the database would I be testing for?
I'm following http://www.web2py.com/AlterEgo/default/show/260 , but while that page explains HOW to go about unit testing, it doesn't explain what I should be testing for. Anyone experienced with TDD in web2py want to point me in the right direction? Thanks in advance!
--