Copyright (C) 2015-2024 CEA, EDF, OPEN CASCADE This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA See https://www.salome-platform.org/ or email : webmaster.salome@opencascade.com This package contains a test driver to run component tests in a SALOME session. This note presents the procedure to declare tests that will be runnable from a SALOME application (through the salome command). I. Write, declare, build and install tests ========================================== Each module test folder must contain: - a set of test source files - a CMakeLists.txt that: - declare unit tests (not requiring a SALOME session) only - build test files from sources if necessary - install test files in /bin/salome/test/ - install the CTestTestfileInstall.cmake file (see below) as /bin/salome/test/CTestTestfile.cmake (rename file) - a CTestTestfileInstall.cmake that: - declare tests requiring a SALOME session, or tests that do not require a SALOME session but to be tested in SALOME execution environment. The CTestTestfileInstall.cmake can also declare unit tests already declared in CMakeLists.txt. Actually CTestTestfileInstall.cmake declares all tests that will be runnable from SALOME application. For easier maintenance shared tests may be declared in a dedicated tests.set file which is then included in both CMakeLists.txt and CTestTestfileInstall.cmake files: INCLUDE(tests.set) The CTestTestfileInstall.cmake file MUST NOT use cmake environment variables. It can refer the ABSOLUTE_APPLI_PATH variable (automatically set when using application). If a test has to be run inside a SALOME session, use the salome_test_driver.py script that need as arguments a timeout, the test file to be run and its arguments. SET(SALOME_TEST_DRIVER "$ENV{ABSOLUTE_APPLI_PATH}/bin/salome/appliskel/salome_test_driver.py") SET(TIMEOUT 500) ADD_TEST(SalomeLauncher python ${SALOME_TEST_DRIVER} ${TIMEOUT} test_launcher.py) Call explicitly python when using this test driver. You may want to label each test with the component they are associated to. It is useful to run tests associated to a specific component. SET(COMPONENT_NAME KERNEL) SET_TESTS_PROPERTIES(SalomeLauncher PROPERTIES LABELS "${COMPONENT_NAME}") You can have a look at KERNEL/src/Launcher/Test/ directory for a working example. II. Run tests ============= Tests are run with the "salome test" command (in a terminal). Enter "salome test --help" for detailed usage.