> Go for it. But... > > Suppose you have a huge program, full of many more business rules than a blog. > At my day-job, we have 1,700 test cases and 242 fixtures. To cover business > rules, they tend to work together. Each test case needs more than a handful of > those fixtures. >
It can be slow, I have used RSpec to test a lot of stuff, the last project was a huge Java based web service, and yes using givens it took a while to run, but you live with it. I only run tests before I deploy, so it is not a big issue. You can also run tests in the background automatically. If you are really concerned with speed, you can do what I did in the Java project. Rather than use fixtures, which was also pretty slow (even when run in Java) I loaded the DB directly when the tests start to run, and clear them after all tests have run. I wrote some simple Sequel code that loaded the database directly, not through the models, but using inserts. I also used the same sequel code in Givens to load only the data that was needed for specific tests, which reduced the overhead. It still took several minutes to run, but as I said I only ran the full test suite before a deploy. Personally I prefer using the factory paradigm to the fixture paradigm, but I use both where necessary. For instance when running integration tests using stories (or cucumber these days), I have to preload the database with a known set of data, as the integration test exercises the entire stack. In this case I use something very similar to fixtures, loading the entire dataset directly using inserts. Its a pain to maintain the dataset though especially when you have a lot of foreign keys, and associated constraints. but you do what you have to do. I'll add examples of these techniques to wolfmanblog, when I get a chance. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
