Testing with HTF

2019-01-24 02:13发布

问题:

There's an incredible lack of decent documentation on HTF. All I could find was a Tutorial which doesn't provide any of the following really important information:

  1. How do I create a test suite that automatically executes all tests from packages?
  2. What exactly are those "Black box tests" of HTF and how do I create them?
  3. What are the actual standards of setting up a test suite based on HTF (source root, packages and modules structure, cabal)?

回答1:

The new release 0.9.0.0 of HTF (see http://hackage.haskell.org/package/HTF-0.9.0.0 and https://github.com/skogsbaer/HTF/) hopefully answers all your questions. I'll summarize:

  • Answer to question 1: See the tutorial, http://hackage.haskell.org/packages/archive/HTF/0.9.0.0/doc/html/Test-Framework-Tutorial.html. It explains how to setup a main module that executes all tests defined in your package, see the section "Test definitions in multiple modules"

  • Answer to question 2: The documentation of the BlackBoxTest module http://hackage.haskell.org/packages/archive/HTF/0.9.0.0/doc/html/Test-Framework-BlackBoxTest.html now explains in detail what a black box test is and how to use it.

  • Answer to question 3: The HTF repository at https://github.com/skogsbaer/HTF/ now contains a sample directory with a complete sample project.