tasty-process: Test execution of external processes with Tasty

[ gpl, library, program, testing ] [ Propose Tags ] [ Report a vulnerability ]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1
Change log CHANGELOG.md
Dependencies async (>=2.2.5 && <2.3), base (>=4.7 && <5), deepseq (>=1.4 && <1.6), process (>=1.6.4 && <1.7), tasty (>=1.4 && <1.6), tasty-process [details]
License GPL-2.0-only
Copyright (c) 2024 PCloud
Author PCloud
Maintainer heige.pcloud@outlook.com
Category Testing
Home page https://github.com/HEIGE-PCloud/tasty-process#readme
Bug tracker https://github.com/HEIGE-PCloud/tasty-process/issues
Source repo head: git clone https://github.com/HEIGE-PCloud/tasty-process
Uploaded by pcloud at 2024-03-14T07:38:21Z
Distributions
Executables test-executable-sleep, test-executable-simple, test-executable-exitcode, test-executable-echo
Downloads 80 total (0 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
All reported builds failed as of 2024-03-14 [all 1 reports]

Readme for tasty-process-0.1.0.1

[back to package description]

tasty-process

tasty-process is a library for running integration tests with the Tasty testing framework.

Features:

  • Run an external process as a test case
  • Supply input to stdin
  • Test the process' exitcode, stdout and stderr
  • Set timeout for the running process using Tasty's Timeout option
  • Automatic clean up the process after the test

Example

Here is an example Echo program that reads from stdin and echos back to stdout.

module Main (main) where

main :: IO ()
main = getLine >>= putStr

And here is a test case for the Echo program using tasty-process.

import System.Exit (ExitCode (..))
import Test.Tasty (TestTree)
import Test.Tasty.Process

echoTest :: TestTree
echoTest =
  setTimeout (1000000) $ -- set timeout to 1 second
    processTest
      "Echo test" -- test name
      TestProcess
        { process =
          (proc "echo-test" []) -- process to launch with a list of arguments
        , input = "Echo!" -- input to stdin
        , exitCodeCheck = equals ExitSuccess -- check exit code
        , stdoutCheck = equals "Echo!" -- check stdout
        , stderrCheck = equals "" -- check stderr
        }

Documentation

See the Hackage page for detailed API documentation.

GHC Compatibility

tasty-process is tested with GHC version >= 8.6