ctests

ctests is a command which can be used to run automated tests on C++ code built using CMake. To enable it, tests need to be added to the CMakeLists.txt file.

add_test(NAME run_test_short
         COMMAND SingleElement --test
         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

Usage in my project

Automated ctests using GitHub workflows can be created for kMC-FEA. To create this, there are two options:

  1. Using a command runtime option such as --test which would make the program run a special simplified test case
  2. Modifying the program to use input files so that a seperate input file for test can be provided.
    • This is a better option as the solution.pvd file depends on the input to the code so the generate_pvd.py can be automatically called at the end of the simulaiton to generate a solution.pvd using the same input file.