Write and test Fortran code with fpm and unit tests

11 steps · about 4 h 5 min · Beginner

  1. Learn — Fortran Programming Language (guide, fortran-lang.org, 10 min)

    This is the community's official starting page. It points to the quickstart, best-practice guides and free courses.

  2. fortran-lang.org/learn/quickstart/hello_world.md (tutorial, fortran-lang.org (GitHub), 15 min)

    Set up gfortran and compile your first program before you add any tooling.

  3. First steps with fpm — Fortran Package Manager (tutorial, fpm.fortran-lang.org, 15 min)

    Teaches the fpm commands new, run and test. fpm generates a project and a test stub for you.

  4. Packaging with fpm (doc, fortran-lang.github.io/fpm, 25 min)

    Shows how to lay out a library plus an app, and where fpm looks for tests such as test/main.f90.

  5. Adding dependencies — Fortran Package Manager (tutorial, fpm.fortran-lang.org, 30 min)

    Walks through adding test-drive as a development dependency and running your first real test.

  6. fortran-lang/test-drive (repo, GitHub (fortran-lang), 30 min)

    This is the small standard-Fortran framework that the fpm tutorial uses. Read its README to learn test suites and checks.

  7. Unit Testing Frameworks for Fortran - Poll (article, Fortran Discourse, 15 min)

    Gives you a map of the alternatives and community opinions, so you can pick a framework.

  8. everythingfunctional/veggies (repo, GitHub (Brad Richardson), 25 min)

    Shows a different style, behaviour-driven tests with readable output, and runs with fpm test.

  9. Goddard-Fortran-Ecosystem/pFUnit (repo, GitHub (NASA Goddard), 30 min)

    This is the JUnit-style framework for larger codebases and MPI-parallel code, where tests need more features.

  10. FOSDEM 2026 - Unit Testing in Fortran (article, FOSDEM, 30 min)

    Covers the obstacles to testing legacy Fortran, such as global state and oversized subroutines, and compares three frameworks.

  11. Fortran Package Manager playground - Announcements (article, Fortran Discourse, 20 min)

    Lets you build and run tests of real fpm packages across compilers without a local setup, as a final experiment.