https://github.com/sciensoft/fluenttests
A Golang test library to increase productivity by providing helpful methods for you to write TDD and BDD-style tests using a fluent language, allowing you to easily organize your tests following the Arrange, Act, and Assert pattern. Plus, several assertions methods for types, contracts, strings, integers, floats, and more to speed up your SDLC.
https://github.com/sciensoft/fluenttests
assertions go golang testing
Last synced: 5 months ago
JSON representation
A Golang test library to increase productivity by providing helpful methods for you to write TDD and BDD-style tests using a fluent language, allowing you to easily organize your tests following the Arrange, Act, and Assert pattern. Plus, several assertions methods for types, contracts, strings, integers, floats, and more to speed up your SDLC.
- Host: GitHub
- URL: https://github.com/sciensoft/fluenttests
- Owner: sciensoft
- License: apache-2.0
- Created: 2023-03-22T19:54:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-03T07:18:50.000Z (about 2 years ago)
- Last Synced: 2026-01-12T02:01:42.473Z (5 months ago)
- Topics: assertions, go, golang, testing
- Language: Go
- Homepage:
- Size: 87.9 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE-OF-CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Fluent Tests
A Golang test library to increase productivity by providing easy-to-use methods for you to write TDD and BDD-style tests using a fluent language, allowing you to easily organize your tests following the Arrange, Act, and Assert pattern. Plus, several assertion methods for types, contracts, strings, integers, floats, and much more to speed up your SDLC.
**📢 Hear ye, hear ye!** Contributors always welcomed. If you want to get involved and help me write this testing tool for our peers Gophers, please ping me on the [fluenttests Discord] channel.
## Get Started
```bash
go get github.com/sciensoft/fluenttests
```
### Usage
```go
func TestFluentContractsShouldHaveMember(t *testing.T) {
// Arrange
fluent := contracts.Fluent[any](t)
contractType := reflect.TypeOf(struct { Name string }{})
fieldType := reflect.TypeOf("")
// Act
author := repository.RetrieveAuthorById(1) // Returns: struct { Name string }{}
// Assert
fluent.It(author).
Should().BeOfType(contractType).
And().HaveField("Name").OfType(fieldType).WithValue("Benjamin Treynor")
}
```
For more samples, please visit [the tests] written to test this own library.
## Features
- Assertions to validate
- Types,
- Strings,
- Integers,
- and Floats
- Assertions to validate Structs, Interfaces/Objects contracts
### Roadmap
- Support to `complex64`, and `complex128` types
- Add support to `reflect.Kind` for the testing methods `.BeOfType()`, and `.OfType()`
- Add more auxiliary methods for structs, interfaces, strings, floats, and integers
- Add support asynchronous tests
- Add support for panic testing
## Contributions
Before start contributing, check our [CONTRIBUTING] guidelines out. Also, before making any significant change, look at the existing Issues and Pull Requests. One of them may be tackling the same thing.
## Issues
Please use the [Issues] tab to open an issue or suggest a new feature.
## License
Copyright 2023 Sciensoft
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).
[CONTRIBUTING]: ./CONTRIBUTING.md
[Issues]: ./../../../issues
[the tests]: ./test
[fluenttests Discord]: https://discord.com/channels/1005225996162707476/1206883413814939678