Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dev:unittesting [2018/02/07 16:07]
127.0.0.1 external edit
dev:unittesting [2022/05/06 16:07] (current)
Line 1: Line 1:
-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.+====== Unit Testing ======
  
 +===== Running the Unit Tests =====
  
 +First, check with the README to see what the latest approach is.  As of this writing (June 2019), this works:
  
-A couple of unit tests for Rosegarden have been written in src/test.+  mkdir build 
 +  cd build 
 +  cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON 
 +  make 
 +  make test
  
 +The tests themselves are .cpp files in the test directory (e.g. test/accidentals.cpp).  The test/CMakeLists.txt file has a list of the tests that will be built/run.  Individual tests can be run directly from the build directory:
  
 +  build/test/accidentals
  
-== Building ==+===== Older Unit Testing Information =====
  
 +**//This information appears to be outdated.//**
  
 +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.
  
-Enable WANT_TEST in ccmake and build the codebase as usual+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 == +==== Running ====
- +
  
 Run 'make test' Run 'make test'
  
- +==== Creating new unit tests ====
- +
-== Creating new unit tests == +
- +
  
   * write tests in src/test/foo.cpp   * 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.   * 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   * add to src/TestFileList.txt
 +  * Enjoy :)
  
-  * Enjoy :) 
 
 
dev/unittesting.txt · Last modified: 2022/05/06 16:07 (external edit)
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki