From: Robert Feldt Date: 2003-05-28T08:07:33+09:00 Subject: Re: Project Directory Structure On Wed, 28 May 2003, Jim Freeze wrote: > > Yet another issue is whether people recommend structure within test dir? I > > have started using the same structure as in lib and ext ie. the unit tests > > for the code in lib/cryptor/public_key goes into > > tests/unit/cryptor/public_key etc (I use "tests/unit" since I have > > acceptance tests in tests/acceptance but maybe that is taking things too > > Sorry to be stupid, but how do acceptance tests differ from unit > tests and why do you want to keep them seperate? Would not all > of them be necessary for full validation? > Sure. I'm not sure its very meaningful but I tend to call tests with externally spec'ed test data acceptance tests and rest unit tests. Example is in my cryptography library where acceptance tests use test data vectors for RSA encryption specified in PKCS #1 RSA paper from RSA labs while unit tests for RSA encryption has a large number of tests on random data, exceptional cases etc. I'm not 100% sure this separation adds enough value to warrant the added "complexity" but I kind of like it... ;) I think I like it because when writing the acceptance tests I typically think about the externally visible API, the "end-product" delivered by the app/lib/extension. I put on "a different hat" so to speak. Unit tests are more nitty-gritty. Often the division is not meaningful though and especially not in a dynamic language like Ruby where there is often no idea in thinking about external and internal parts/classes; everything is malleable. > > also have a single script tests/run_all_tests.rb so that the command > > > > ruby -Ilib tests/run_all_tests.rb > > > > runs them all. > > > I use a top level make inside test and just do: > > make > > which recursively calls all my tests. I find this very useful, > but have not proved it for multiple OS's (ie, may not be windows > friendly). > Pro with having a ruby script is that anyone installing a ruby extension can be assumed to have Ruby while not everyone will have make (ok, many/most have). Also the run_all_tests script can do "smart" things like searching for the tests to load/run, only run tests that matches certain regexps. No biggie of course and I'm sure you can also do it nicely with make. Regards, Robert