[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: Test framework thoughts
> There are a few testing libraries that are easy to incorporate (e.g. oUnit or > Kaputt), but I've been wondering if we can just use ocamlbuild to make things > much easier. It supports dynamic build dependencies (much as our CIEL > framework also does), so a test can block mid-test and wait for another > target to finish. > An individual test could be written as a module (say Foo), with a foo.test > file that describes any dependencies and parameters, and ocamlbuild could > just run them in parallel. I'm still thinking it through, but wondering if > anyone else has any thoughts on this. I don't see why using ocamlbuild can really help here. What I have started to do in another project is the following : * The unit-tests of foo.ml are written in foo_test.ml, in keeping the same structure (ie. if you have Bar.x inside foo.ml, then you have an easy way to register the test "Bar.x" in foo_test.ml : module Bar = struct let x = Test.group "x" [ test (fun () -> <something which returns bool> ] let test = Test.group "Bar" [ x ] end * At the end of foo_test.ml, you have something like : Test.register [ Bar.test ] * And then elsewhere, you have a main test file which just does : Test.run (). The trick is to -linkall all the *_test.ml in the right order when creating the test binary. Also, Test.run () catches all the exception that unit-tests can raise, and try to run all the possible tests. For the complex settings to run some of the unit-tests, I guess you need to have a library able to set-up correctly you environment, and use register some post and pre-hooks if needed. -- Thomas > > Anil
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |