Salome HOME
updated copyright message
[modules/kernel.git] / bin / appliskel / salome_tester / README
1 Copyright (C) 2015-2023  CEA, EDF, OPEN CASCADE
2
3 This library is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Lesser General Public
5 License as published by the Free Software Foundation; either
6 version 2.1 of the License, or (at your option) any later version.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 Lesser General Public License for more details.
12
13 You should have received a copy of the GNU Lesser General Public
14 License along with this library; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16
17 See https://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18
19
20 This package contains a test driver to run component tests in a SALOME session.
21 This note presents the procedure to declare tests that will be runnable from a SALOME application (through the salome command).
22
23
24 I. Write, declare, build and install tests
25 ==========================================
26
27 Each module test folder must contain:
28    - a set of test source files
29    - a CMakeLists.txt that:
30       - declare unit tests (not requiring a SALOME session) only
31       - build test files from sources if necessary
32       - install test files in <module_install_path>/bin/salome/test/
33       - install the CTestTestfileInstall.cmake file (see below) as <module_install_path>/bin/salome/test/CTestTestfile.cmake (rename file)
34    - a CTestTestfileInstall.cmake that:
35       - declare tests requiring a SALOME session, or tests that do not require a SALOME session but to be tested in SALOME execution environment.
36
37 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:
38       INCLUDE(tests.set)
39
40 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.
41       SET(SALOME_TEST_DRIVER "$ENV{ABSOLUTE_APPLI_PATH}/bin/salome/appliskel/salome_test_driver.py")
42       SET(TIMEOUT        500)
43       ADD_TEST(SalomeLauncher python ${SALOME_TEST_DRIVER} ${TIMEOUT} test_launcher.py)
44 Call explicitly python when using this test driver.
45
46 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.
47       SET(COMPONENT_NAME KERNEL)
48       SET_TESTS_PROPERTIES(SalomeLauncher PROPERTIES LABELS "${COMPONENT_NAME}")
49
50
51 You can have a look at KERNEL/src/Launcher/Test/ directory for a working example.
52
53
54 II. Run tests
55 =============
56
57 Tests are run with the "salome test" command (in a terminal).
58 Enter "salome test --help" for detailed usage.