2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2015,2017,2019, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
37 * Dummy header for \ref module_testutils documentation.
39 * \author Teemu Murtola <teemu.murtola@gmail.com>
40 * \ingroup module_testutils
42 /*! \libinternal \defgroup module_testutils Testing Utilities (testutils)
44 * Common helper classes and functions for writing tests using Google Test.
46 * General documentation for the testing in \Gromacs can be found in the
47 * \linktodevmanual{index,developer guide}. This page provides an overview of
48 * the actual API provided by the `testutils` module.
50 * There are several distinct functionalities provided:
51 * - gmx::test::TestFileManager (in testfilemanager.h) provides functionality
52 * for locating test input files from the source directory and managing
53 * temporary files that need to be created during the test.
54 * - gmx::test::TestFileInputRedirector (in testfileredirector.h) provides
55 * functionality for capturing file existence checks in code that uses
56 * gmx::IFileInputRedirector.
57 * - gmx::test::TestFileOutputRedirector (in testfileredirector.h) provides
58 * functionality for capturing file output (including `stdout`) from code
59 * that uses gmx::IFileOutputRedirector, and checking that output
60 * against reference data.
61 * - gmx::test::InteractiveTestHelper (in interactivetest.h) provides
62 * a helper class for testing an interactive session that uses
63 * gmx::TextInputStream and gmx::TextOutputStream for prompting input and
64 * printing status messages.
65 * - #GMX_TEST_OPTIONS macro provides facilities for adding custom command
66 * line options for the test binary.
67 * - testasserts.h provides several custom test assertions for better
68 * exception and floating-point handling than built-in Google Test
70 * - gmx::test::TestReferenceData and related classes (in refdata.h) provide
71 * utilities to write regression-style tests that check that the test
72 * produces the same results as an earlier run of the same test.
73 * See \ref page_refdata for more details.
74 * - gmx::test::CommandLine and related classes (in cmdlinetest.h) provide
75 * utilities for constructing command line argument arrays for use in tests
76 * that invoke actual commands. The same header also provides
77 * gmx::test::CommandLineTestHelper and gmx::test::CommandLineTestBase
78 * for easily creating tests that execute essentially full command-line
79 * programs, including checking the output files produced.
80 * - gmx::test::StringTestBase provides a test fixture for tests that need to
81 * test long strings for correctness.
82 * - gmx::test::StdioTestHelper provides a helper class for tests that need to
83 * execute legacy code where `stdin` reading cannot be easily mocked.
85 * Additionally, testinit.h and mpi_printer.h, and their corresponding source
86 * files, provide functionality that is not visible on the API level: they
87 * provide initialization routines for the above functionality, which are
88 * automatically called by the %main() function provided in unittest_main.cpp.
90 * mpi_printer.h provides a Google Test listener that is installed when the
91 * tests are compiled with MPI. This listener allows the test binary to be run
92 * on multiple MPI ranks, and synchronizes the execution and output from the
93 * test cases, as well as makes the test fail on even if an assertion fails
96 * \ingroup group_utilitymodules