Thanks Richard, for now I am going to create a special database table that will follow the structure of the actual data tables, but with a fixed data set like you suggested (controls for count very well).
I'm still interested in any real examples people use for unit testing databases and controller functions, I'm sure i'm glossing over something! On Monday, July 23, 2012 7:40:51 AM UTC-7, Richard wrote: > > I am interesting in what will come out of this thread... > > But, to me I think your last question on fact that database will have > undertermined set of data mean that you maybe not validate your app base on > the entries of the database but on a testing database with a set of known > data, that you can even charge on need for the test. Also, you will just > test the limit with data that will for example help to demonstrate that a > field type is appropriately defined to get all type of data you intend to > put in in. Count, if variable get creates, etc., is more in the basic thing > you can always check for every function... > > I am also pretty new to unit test in general and have most the same > questions. > > Cheers! > > Richard > > > On Sun, Jul 22, 2012 at 9:41 PM, Mark Li <[email protected]> wrote: > >> 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! >> >> -- >> >> >> >> > > --

