3.6 Software Testing Approaches

3.6.1 Unit Tests

Unit testing, sometimes called “module testing” or “element testing”, is a software testing method by which individual “units” of source code are tested to determine whether they are fit for use [44]. Unit tests are added to Nektar++ through the CMake system, and implemented using the Boost test framework. As an example, the set of linear algebra unit tests is listed in this file:

.../library/UnitTests/LibUtilities/LinearAlgebra/CMakeLists.txt

and the actual tests are implemented in this file:

.../library/UnitTests/LibUtilities/LinearAlgebra/TestBandedMatrixOperations.cpp

To register a new test, you use BOOST_AUTO_TEST_CASE( TestName ), implement the unit test, and test the result using BOOST_CHECK_CLOSE(...), BOOST_CHECK_EQUAL(...), etc. Unit tests are invaluable in maintaining the integrity of the code base and for localizing, finding, and debugging errors entered into the code. It is important to remember a unit test should test very specific functionality of the code - in the best case, a single function should be tested per unit test.

While it is beyond the scope of this document to go into more detail on writing unit tests, a good summary of the Boost test system can be found here:

http://www.boost.org/doc/libs/1\_63\_0/libs/test/doc/html/.

3.6.2 Integration, System and Regression Tests

Integration testing involves testing ecosystems of components and their interoperability. System testing tests complete applications and regression testing focuses on ensuring previously fixed bugs do not resurface. In Nektar++ all of these are often colloquially referred to as regression testing. It is not white-box in that it does not examine how the code arrives at a particular answer, but rather in a black-box fashion tests to see if code when operating on certain data yields the predicted response [44].

3.6.3 Continuous Integration

Nektar++ uses the buildbot continuous integration to perform testing of the code across multiple operating systems. Builds are automatically instigated when merge requests are opened and subsequently when the associated branches receive additional commits.

For more information, go to:

http://buildbot.nektar.info