tasty-coverage: Ingredient for tasty which generates per-test coverage reports

[ bsd3, library, testing ] [ Propose Tags ]

An ingredient for the tasty testing framework which allows to generate per-test coverage reports. For every test "foo" a file "foo.PASSED.tix" or "foo.FAILED.tix" is generated, depending on whether the test passed or failed.

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS],,,
Change log CHANGELOG.md
Dependencies base (>=4.16 && <4.20), containers (>=0.6 && <0.7), filepath (>=1.3.8 && <=1.5), hpc (>=0.6 && <0.8), tasty (>=1.4 && <1.6) [details]
License BSD-3-Clause
Copyright David Binder, 2023
Author David Binder
Maintainer david.binder@uni-tuebingen.de
Category Testing
Home page https://github.com/BinderDavid/tasty-coverage
Bug tracker https://github.com/BinderDavid/tasty-coverage/issues
Source repo head: git clone git@github.com:BinderDavid/tasty-coverage.git
Uploaded by DavidBinder at 2023-09-15T13:43:31Z
Distributions NixOS:
Downloads 116 total (10 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-09-15 [all 1 reports]

Readme for tasty-coverage-

[back to package description]


A tasty ingredient which allows to generate per-test coverage data.

If the GHC compiler is passed the -fhpc flag, then the generated code is instrumented in order to also emit information about the executed parts of the sourcecode at runtime. This coverage information is written to a file with the suffix .tix. For testsuites it is sometimes more useful to have the coverage information for each test individually. This information can be collected using the methods from the Trace.Hpc.Reflect module from the hpc library. The tasty-coverage package provides a simple ingredient for the tasty testsuite driver which allows to run the testsuite with the --report-coverage option. When this option is passed, one .tix file is generated for each individual test. Passing tests have the file suffix PASSED.tix, whereas failing tests have the suffix FAILED.tix.

> cabal run tasty-coverage-test -- --help
Mmm... tasty test suite

Usage: tasty-coverage-test [-p|--pattern PATTERN] [-t|--timeout DURATION] 

Available options:
  -h,--help                Show this help text
  -p,--pattern PATTERN     Select only tests which satisfy a pattern or awk
  -t,--timeout DURATION    Timeout for individual tests (suffixes: ms,s,m,h;
                           default: s)
  --report-coverage        Generate per-test coverage data

> cabal run tasty-coverage-test -- --report-coverage
Wrote coverage file: tix/UnitTests.testOne.PASSED.tix
Wrote coverage file: tix/UnitTests.testTwo.PASSED.tix
Wrote coverage file: tix/UnitTests.testThree.FAILED.tix