Fortuno – parallel unit testing framework for Fortran

Dear Fortran community,

we’re excited to announce the first public release of Fortuno, a parallel, xUnit-like unit testing framework for the Fortran language.

Features:

  • serial unit testing,
  • parallel unit testing for MPI and coarray-based projects,
  • simple unit tests, fixtured tests, parameterized tests,
  • automatic test registration (in combination with the
    Fypp-preprocessor), and
  • seamless integration with fpm, CMake, and Meson build systems

Fortuno is designed for ease of use, keeping boilerplate code to a minimum so that test routines remain straightforward. A simple serial unit test, for instance, is just a subroutine without any arguments! Modularity and extensibility are central to Fortuno, as seen for example in the serial, MPI, and coarray testing interfaces, which are just shallow layers above the core library.

The framework has already been adopted by a few projects, so while we’re still at version 0.1, the user interface is expected to remain stable. Our documentation is evolving, but the provided examples should make it easy to set up Fortuno for your project. For new projects, we offer a template generator that creates a standalone project optional Fortuno integration. You can also find a brief introduction to Fortuno on ReadTheDocs.

Future plans:

We plan to keep developing Fortuno to provide a reliable unit testing tool that supports a wide range of Fortran projects. As developers of scientific simulation packages, we focus primarily on creating features that support the testing needs of scientific software. Fortuno is an open source project, comments, suggestions, and contributions are welcome!

We hope, that Fortuno turns out to be useful also for your project!

Some thoughts on the relationship between Fortuno and test-drive

Extending test-drive seemed like a natural and desirable starting point. We, nevertheless, opted for creating Fortuno as a separate project for three main reasons:

  1. Complexity: Fortuno is designed to be a comprehensive library with a wide range of features that we believe are essential for unit testing. Rather than focusing on simplicity (e.g. keeping the possibility of a single-file distribution), Fortuno’s long term goal is to provide a full-featured testing solution.

  2. Compatibility: To support parallel testing (and also for some other benefits), Fortuno uses context objects rather than allocated error objects to record testing results. This change would have disrupted existing test-drive-based tests. (However, Fortuno became in the mean time quite flexible, so it should be now possible to add a shallow compatibility layer that aligns with test-drive conventions.)

  3. Compiler Support: Fortuno’s object-oriented approach revealed quite a few compiler-specific issues, which we had to resolve with custom workarounds (and reported to the compiler developers). As a result, Fortuno requires recent compiler versions—GNU 13.2, Intel 2024, or NAG 7.2—and we don’t plan to support older versions. This approach may differ from test-drive’s philosophy on compiler compatibility. (But hey, on the plus side, Fortuno can also serve as a helpful test case for new Fortran compilers in development! :smile:)

15 Likes