Midgard unit and regression tests
Posted on 2008-08-25 22:43:44 EEST.
I must say, I do like GLib testing framework. I already started writing Midgard tests, but still wondering what, how and why should be changed. Even now, when few things seems to be too difficult to implement, I see many very nice features:
- Test can be automated (ok, not a big deal)
- Test program with routines might be run through
gtester - Once it's done, one may create xml report
- Once xml is created, one is able to make it much more user friendly
GTester Unit Test Report
| Program / Testcase | Duration (sec) | View | Result |
|---|---|---|---|
| midgard_test | 3.220978 | ER OK | 100.00% |
| /midgard_config | 0.000880 | - | success |
| /midgard_connection | 0.017047 | - | success |
| /midgard_database/create | 1.514101 | - | success |
| /midgard_database/update | 1.476490 | - | success |
| /midgard_object/basic | 0.011082 | - | success |
| /midgard_object/basic/create | 0.193323 | - | success |
| /midgard_object/basic/update | 0.000527 | - | success |
| /midgard_object/fetch | 0.001588 | - | success |
| Totals: 1 Binaries, 8 Tests, 0 Failed, 8 Succeeded | 3.220978 | - | 100.00% |
As test program is invoking typical API functions, I can easily run it via valgrind and catch memory leaks before they appear on production servers. And with some nice test separation, reported duration could be quite usefull to notice some obvious performance bottlenecks.