Skip to main content

Numerical regression testing

Project description

nrtest

PyPI Package Build Status Code Coverage Documentation Status

nrtest is an end-to-end regression testing framework, designed for scientific software that perform numerical calculations.

Features

nrtest aims to simplify your workflow:

  • JSON files describe the software under test and the tests themselves

  • result files are stored in a portable benchmark directory

  • benchmarks are compared by iterating through tests and their results

Basic Usage

As an example usage, we consider testing TOPAS. This is a Monte Carlo tool for particle simulation, designed for medical physics research. Of course, such a tool must be rigorously validated against experimental data. But it is also useful to frequently run shorter tests, checking for regressions by comparing results to a previous version.

First, we describe the software under test in a configuration file called apps/topas-2.0.3.json. Note that setup_script defines the environment needed to run the software.

{
    "name": "topas",
    "version" : "2.0.3",
    "setup_script" : "/path/to/topas-2.0.3/setup.sh",
    "exe" : "topas"
}

We then describe the test in second configuration file called tests/Scoring_01.json. In doing so, we define the command-line arguments presented to the executable and the input files needed for the test to run. Finally, we also specify the expected output files, and declare how they should be compared to a benchmark. In this case, we use topas binned (a custom comparison routine) though other comparison routines are available.

{
    "name": "Scoring_01",
    "version": "1.0",
    "description": "Basic test shooting a 6cm diameter proton beam into a water phantom.",
    "args": [
        "Scoring_01.txt"
    ],
    "input_files": [
        "Scoring_01.txt",
        "GlobalParameters.txt"
    ],
    "output_files": {
        "Dose.csv": "topas binned"
    }
}

To execute the test, we tell nrtest where to find the configuration files and where to output the benchmark. Note that nrtest will search tests/ for tests, though we could have specified tests/Scoring_01.json.

$ nrtest execute apps/topas-2.0.3.json tests/ -o benchmarks/2.0.3
INFO: Found 1 tests
Scoring_01: pass
INFO: Finished

To compare to a previous benchmark:

$ nrtest compare benchmarks/2.0.3 benchmarks/2.0.2
Scoring_01: pass
INFO: Finished

More advanced usage is detailed in the documentation.

History

0.1.0 (2016-02-21)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nrtest-0.1.2.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

nrtest-0.1.2-py2.py3-none-any.whl (16.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file nrtest-0.1.2.tar.gz.

File metadata

  • Download URL: nrtest-0.1.2.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for nrtest-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9bb7fd4bd14e52e75afd081e82869ee11451965fa7c0cbf30ca88c61484b9d5b
MD5 09733103edf33141bd0812de6be7d5ca
BLAKE2b-256 3b6440b87deb5a3d89508b60954d0444182c37515567ba3fc93d32e38b723759

See more details on using hashes here.

Provenance

File details

Details for the file nrtest-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for nrtest-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c30cde2767cddbb2bbb4de2bfbe7f2448c7db6a77dbad8c39806a9c8902a9fc8
MD5 0fb48625bad76b24af2f560f3c39c981
BLAKE2b-256 504071e2d97dadfaac43bb70ee906621de2b42a62bf6a8547bd0280ca0c15ee9

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page