GNOME Bugzilla – Bug 590237
Reusable tests and generics
Last modified: 2009-09-03 15:51:05 UTC
Until now tests are encapsulated in global functions. It would be simpler and more powerful to encapsulate tests in fixtures with a common setup and teardown method call respectively before and after each test like many other testing framework do. The use case could be as followed: class MyTest: TestFixture { public MyTest(string name) { base(name); add_test("test1", test1); add_test("test2", test2); } public void setup () { ... } public void teardown () { ... } public void test1 () { ... } public void test2 () { ... } .... } void main () { MyTest test = new MyTest ("MyTest"); Test.get_root ().add_suite (test.get_suite ()); Test.run (); } A first try was already implemented about test fixture but need to be validated. Furthermore, tests on generic containers are currently containing several common code then the goal is here, if possible, to make tests as generic as possible for those cases.
(In reply to comment #0) The first step of the work (make CollectionTests generic) is done but need to be validated. My personal branch 'jpeeters' is accessible at http://github.com/jpeeters/libgee/tree/jpeeters A error remains at runtime but it depends on Vala instead of Gee I think.
Created attachment 139931 [details] [review] Patch for generic testing
Generic tests will be no longer used. So this bug report does not have sense anymore.