Skip to content

FoamScience/foamUT

Repository files navigation

A unit/integration testing framework for OpenFOAM code

This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks.

This is a unit/integration testing framework to help test-proof new OpenFOAM code (might be too late for the OpenFOAM library itself). This repository will always work with the latest versions of the main three OpenFOAM forks: ESI OpenCFD's, Foundation version and Foam-Extend.

If you intend to write cross-forks code, this can help you maintain your sanity. You can just keep branches for each fork on your code's repository and invoke CI on them with the help of this testing framework.

A quick demo

OpenFOAM unit testing in action

How to use this repo

The Alltest script loops through OpenFOAM cases and runs corresponding test cases (for directories it finds under tests) - both in serial and in parallel.

You can use this to your advantage as you don't need to include this repo into your code base:

  1. In your library's repo, write tests the way you like; ship them with their own Make directory to compile the test driver (see example tests)
  2. In your CI workflows, checkout this repository and symlink your tests somewhere under tests
    ln -s /path/to/your/tests tests/myLibTests
  3. Do the same for your OpenFOAM cases if you have any (only a simple cavity case is provided by default). Put these under cases.
  4. Run ./Alltest to compile and run your tests on your cases.
  5. If you run ./Alltest.report instead, HTML reports will be generated for your tests inside reports/tests directory.

Documentation

Head to the wiki to read few more words about this framework. There is also a FAQ there.

Contributing

Ease of use and portability across OpenFOAM forks are the main focus of this framework. As long as your contribution doesn't hinder one of those two objectives; it will be welcomed! And PRs against master are the way to go.

About

The Catch2-based Unit/Integration testing framework for OpenFOAM code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published