Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bcpeinhardt/testbldr
Programatically build test suites in Gleam
https://github.com/bcpeinhardt/testbldr
Last synced: about 1 month ago
JSON representation
Programatically build test suites in Gleam
- Host: GitHub
- URL: https://github.com/bcpeinhardt/testbldr
- Owner: bcpeinhardt
- Created: 2023-09-05T17:39:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-01T17:51:09.000Z (10 months ago)
- Last Synced: 2024-10-10T19:20:58.731Z (2 months ago)
- Language: Gleam
- Size: 20.5 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- awesome-gleam - testbldr - [📚](https://hexdocs.pm/testbldr/) - A library for programatically building and running test cases (Packages / Testing)
README
# testbldr
[![Package Version](https://img.shields.io/hexpm/v/testbldr)](https://hex.pm/packages/testbldr)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/testbldr/)This library is a dead simple set of utilities for building test suites programatically.
Most of the time it makes sense to have one test signature per test, and have those tests
automatically discovered and run.
Other times you may want to read test cases in from files, json responses, etc.
This library is for the second case.# Example
```gleam
import testbldr
import gleam/list
import gleam/intpub fn main() {
let test_runner =
testbldr.test_runner_default()
|> testbldr.include_passing_tests_in_output(True)
|> testbldr.output_results_to_stdout()let tests = {
use n <- list.map([1, 3, 5, 8, 9])
use <- testbldr.named(int.to_string(n) <> " is odd")
case n % 2 == 1 {
True -> testbldr.Pass
False -> testbldr.Fail(int.to_string(n) <> " is even, not odd")
}
}test_runner
|> testbldr.run(tests)
}
```