SOFA plugin: SofaTest  master
Open source framework for multi-physics simuation
SOFA plugin: SofaTest Documentation

This is the test suite of Sofa. It contains base classes to ease the development of tests, such as sofa::Sofa_test , sofa::Mapping_test, etc. The actual tests are implemented in sub-directories of the modules and plugins. For instance, SofaRigid/SofaRigid_test/RigidMapping_test.cpp.

The tests are optional. They are activated using the SOFA-MISC_TESTS flag of the cmake configuration. This generates a set of executables, each of them running the test suite of the module. For instance, from the debug build directory, run:

bin/SofaConstraint_testd

To run all the tests, run command

ctest --verbose

Motivation and detail about activation is given in http://wiki.sofa-framework.org/wiki/UnitTesting

The tests are based on the googletest framework http://code.google.com/p/googletest/wiki/Documentation

Data files

Some tests require to open data files. These are typically located in the same directory as the test code. The path to the current directory can be defined in the CMakeLists.txt, and passed by the compiler as a predefined symbol. For instance, if you set the following line in CMakeLists.txt:

AddCompilerDefinitions("THIS_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"")

then the following instruction creates a complete, absolute path to fileName:

std::string fileName = std::string(THIS_DIR) + "/" + fileName;

See e.g. SofaTest_test/CMakeLists.txt and SofaTest_test/LoadScene_test.cpp

Author
François Faure, Aurélie Dégletagne, and hopefully lots of others !
Date
Started in 2013

This is a the starting page of the plugin documentation, defined in file doc.h in the plugin directory.