Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heige-pcloud/tasty-process
Test execution of external processes with Tasty
https://github.com/heige-pcloud/tasty-process
haskell integration-testing tasty testing
Last synced: about 2 months ago
JSON representation
Test execution of external processes with Tasty
- Host: GitHub
- URL: https://github.com/heige-pcloud/tasty-process
- Owner: HEIGE-PCloud
- License: gpl-2.0
- Created: 2024-03-12T11:37:11.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-14T08:31:30.000Z (11 months ago)
- Last Synced: 2024-11-16T13:38:08.468Z (2 months ago)
- Topics: haskell, integration-testing, tasty, testing
- Language: Haskell
- Homepage: https://heige-pcloud.github.io/tasty-process/Test-Tasty-Process.html
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# tasty-process
`tasty-process` is a library for running integration tests with the [Tasty](https://github.com/UnkindPartition/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`.
```hs
module Main (main) wheremain :: IO ()
main = getLine >>= putStr
```And here is a test case for the Echo program using `tasty-process`.
```hs
import System.Exit (ExitCode (..))
import Test.Tasty (TestTree)
import Test.Tasty.ProcessechoTest :: 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](https://hackage.haskell.org/package/tasty-process) for detailed API documentation.
## GHC Compatibility
`tasty-process` is tested with GHC version >= 8.6