Tests
CSLE uses pytest for Python tests and integration tests, and jest for JavaScript tests.
The Python unit tests are available at:
csle/simulation-system/libs/csle-base/testscsle/simulation-system/libs/csle-agents/testscsle/simulation-system/libs/csle-attacker/testscsle/simulation-system/libs/csle-collector/testscsle/simulation-system/libs/csle-common/testscsle/simulation-system/libs/csle-defender/testscsle/simulation-system/libs/csle-rest-api/testscsle/simulation-system/libs/csle-ryu/testscsle/simulation-system/libs/csle-system-identification/testscsle/simulation-system/libs/gym-csle-stopping-game/testscsle/simulation-system/libs/csle-cluster/testscsle/simulation-system/libs/gym-csle-intrusion-response-game/testscsle/simulation-system/libs/gym-csle-apt-game/testscsle/simulation-system/libs/gym-csle-cyborg/testscsle/simulation-system/libs/csle-tolerance/testscsle/simulation-system/libs/csle-attack-profiler/tests
To run the Python unit tests, execute the command:
simulation-system/libs/unit_tests.sh
Listing 135: Command to run the Python unit tests.
When adding new Python unit tests note that:
- All unit tests must be written in a
tests/directory inside the Python project. - File names should strictly start with “
tests_”. - Function names should strictly start with “
test”.
The JavaScript unit tests are available at:
csle/management-system/csle-mgmt-webapp/src/
Listing 136: Directory with the JavaScript unit tests.
To run the JavaScript unit tests, execute the command:
cd management-system/csle-mgmt-webapp; npm test
Listing 137: Command to run the JavaScript unit tests.
To run the CSLE integration tests, execute the command:
simulation-system/libs/integration_tests.sh
Listing 138: Command to run the CSLE integration tests.