Unit tests are useful to call code in isolation during development (so you don't need to start the entire GUI to test every change), and for regression tests.

A couple of unit tests for Rosegarden have been written in src/test.

Building

Enable WANT_TEST in ccmake and build the codebase as usual

Running

Run 'make test'

Creating new unit tests
  • write tests in src/test/foo.cpp
  • define an 'int test_foo(int argc, char** argv)'. This method will be called by the test driver, which will report 'Success' if the call returned '0'. If you put multiple tests in one file, this will looks something like 'return test1() + test2() + test3()', where all other tests should also return 0 on success or a positive integer on failure.
  • add to src/TestFileList.txt
  • Enjoy :)
 
dev/unittesting.txt · Last modified: 2008/05/01 11:09 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki