On 12/22/05, Jason Daiger <[EMAIL PROTECTED]> wrote: > > I've been trying to use and implement test driven development on our new > project, via CFUnit, and am struggling w/ other developers on several > fronts, such as justifying the effort but that's another issue, ... I tried to list out some of the benefits of unit testing and TDD in my FA article, which might help some... http://www.fusionauthority.com/Techniques/Article.cfm/ArticleID:4560
> ... but the main > issue is how to efficiently test and exercise the DAO objects. I blogged about this a few weeks ago... http://www.rbdev.net/devblog/index.php?entry=entry051204-154123 If your DB supports stored procedure, I think that is you best avenue for testing DB scripts. You can form unit tests around the procedures themselves. That way you can test the SQL script in the language they are written in. I don't current use an SQL xUnit framework, we have something like custom unit test, but I plan on looking into that when i have time. I think the biggest problem with testing DB from within CFML is that it can be slow. Even if you have a SQL script that runs in less then 100ms, if you have 12 tests you need to run against it, then the test as a whole will be running at over s second. If you have a lot of these SQL scripts to test, then your unit tests may run VERY slowly. This make TDD cumbersome because you would not want to run a long test like that after every little change. If you don't have stored procedure support in your DB then what you are doing sound like a solid approach. If you find that your tests are getting a bit slow because of all the DB calls, I would suggest setting up two testing frameworks for your application – one that tests everything head-to-toe which will only be ran once a day or after major changes. And then a second that would only test key DB integrations that would be a part of your frequently ran TDD tests. I have done this before myself and it works well for larger apps. (PS: When you are done I would be interested in seeing how you did the XML, maybe there is something we can do in CFUnit to make that sort of thing easier) -- Rob Blackburn http://www.rbdev.net
