Adding New Automated Tests - GCMLab/GCMLab-FEM GitHub Wiki
Automated testing can be run using the RunTests.m script in the main file directory. When adding a new feature to the code, the implementation of that new feature should be accompanied by a new test which checks that new feature.
All of the functions necessary for automated testing are stored in the Test Files directory. Each individual test is associated with:
- A config file
- A mesh file
- A check file
- A run file
Config and mesh files determine the loads, mesh, and geometry of each test. Config files contain the direction to the appropriate mesh files. Config and mesh files may be shared by multiple tests for efficiency. Config files are stored in Test Files\Config Files, while mesh files are stored in Test Files\Mesh Files.
Check files take the output from the finite element analysis and calculate some kind of error measurement. The error measurement will depend on the feature and type of test being run. For example, a patch test might calculate the error norm between the finite element displacements and stresses and the known linear displacement field and and constant stresses. Check files may be shared by multiple tests for efficiency. Check files are stored in Test Files\Check Files.
Run files are individual scripts for each test which are run by the RunTests script. The run files do the following:
- Direct the script to the appropriate config file
- Run the finite element analysis
- Depending on the type of test, run files may be used to run multiple analyses - such as in the case of a convergence study.
- Direct the script to the appropriate check file
- Check whether the error measurement calculated by the check file meets some set pass criterion.
- For example, a patch test might check that the calculated error norm between the finite element and exact solution is 0 (i.e, that the solution is exact).
To add a new test, use the template run file, RunTest_Template.m.
- Save the template with a descriptive name.
- Example: RunPatchTestT6.m
- Fill out the header with a short description of what the test runs
- Template:
- Example:
- Update the output test name
- Template:
- Example:
- Direct the run file to the appropriate config files and run the analysis.
- Template:
- Example:
- Direct the run file to the appropriate check file, and set a check criterion.
- Template:
- Example:
- Update RunTests.m to run the test. Provide a descriptive test name, and a brief description of the pass condition.
- Tests can be re-ordered in this file to group similar tests together!
- Template:
- Example:
- Create a Wiki page with details of the geometry, loads, material properties, and the solution against which the finite element results are checked.