pFunit is a Fortran analog to various other xUnit testing frameworks which
have been developed within the software community,and is intended to enable
test driven development (TDD) within the scientific/technical programming
community. pFunit is written (almost) entirely in standard conforming Fortran
95, and was developed using TDD methodology.pFunit is bundled with an extensive
set of self-tests which are intended to evolve along with the primary package.
pFunit includes scripts which can conveniently wrap user-written tests into test suites and assemble those suites into an executable. The lack of true object-orientation and “reflection” within Fortran necessitates this approach. Nonetheless, once added to a developer build system adding/running additional tests requires minimal effort. The exceutable itself is, at least for the moment, command-line driven. If all tests pass, then a simple summary of the number of tests run is returned. If some tests failed, a summary of which tests failed and any associated messages is returned to standard output.
Features that will be of particular interest to the developer of scientific applications include:
- Extensive sets of "assert"; routines for floating point, includingsupport for single and double precision, multidimensional arrays, and various means of expressing tolerances.
- Ability to launch MPI tests and report results back as a single test an essential feature for high-end computing associated with weather and climate modeling.
- Ability to repeat tests across a complex high-dimensional parameter space.The need for this capability arises when multiple input parameters strongly interact within a subsystem. The ability to balance performance concerns against the need to adequately sample the possibilities is very useful. Failing parameter tests report back which combinations of parameters resulted in failures.
The goals of the pFunit project are to provide a shared mechanism for supporting unit testing within the HPC community in the hopes of encouraging best practices for development and maintenance of software. In particular, pFunit aims to be sufficiently minimal to encourage rapid adoption while still providing a minimum threshold of functionality. By providing pFunit as open source, we hope to leverage interest from other groups to enhance portability and usability.
Our functional goals include the ability to create and run tests for procedures written in Fortran. Further, these goals include the ability to test procedures which are implemented using distributed parallelism (e.g. via Message Passing Interface), as well as parameterized tests which sample a potentially large parameter space in some orchestrated manner. A final functional goal is to create the ability within pFunit to capture behavior of legacy software as a unit test. Unlike typical unit tests which can assert a variety of constraints which ought to be true in a correct implementation, tests of legacy systems often must rely on merely preserving existing behavior.
We have two primary evolvability goals. On one front, we desire to simplify the use of pFunit by better support for integration into Eclipse and the Photran plug-in for Eclipse..Our second evolvability goal is centered on the evolution of the Fortran programming language. The most recent standard includes extensions that will simplify pFunit and strongly enhance the ability to generalize its behavior.
The usability goals for pFunit lie along several axes. Portability to all major high-end computing environments is essential. Beyond that, an appropriate GUI for running suites of tests and reporting failures would significantly enhance the enjoyment of using the tool. In the longer term, better automation for crafting test routines by analyzing user software would reduce the burden of introducing tests into legacy software.