Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/b-gonzalez/Fluent-VBA
An object-oriented fluent unit testing library for VBA
https://github.com/b-gonzalez/Fluent-VBA
fluent-api object-oriented-programming oop tdd tdd-vba unit-testing vba
Last synced: about 2 months ago
JSON representation
An object-oriented fluent unit testing library for VBA
- Host: GitHub
- URL: https://github.com/b-gonzalez/Fluent-VBA
- Owner: b-gonzalez
- License: mit
- Created: 2021-09-09T03:01:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-03T17:46:38.000Z (about 2 months ago)
- Last Synced: 2024-12-03T17:52:11.492Z (about 2 months ago)
- Topics: fluent-api, object-oriented-programming, oop, tdd, tdd-vba, unit-testing, vba
- Language: VBA
- Homepage:
- Size: 10.9 MB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - b-gonzalez/Fluent-VBA - An object-oriented fluent unit testing library for VBA (VBA)
README
# Fluent-VBA
Fluent VBA is an object-oriented [fluent](https://en.wikipedia.org/wiki/Fluent_interface) unit testing library for VBA. This project was inspired by [Fluent Assertions](https://fluentassertions.com/introduction) in C#.Fluent APIs are intended to be read like natural language. So instead of having something like:
```vba
Option ExplicitSub NormalUnitTestExample
Dim result as long
Dim Assert as cUnitTester
'//Arrange
Set Assert = New cUnitTester
'//Act
result = returnVal(5) 'returns the value provided as an argument
'//Assert
Assert.Equal(Result,5)
End SubPublic Function returnVal(ByVal value As Variant) As Variant
returnVal = value
End Function
```
You can have code that reads more naturally like so:```vba
Option ExplicitSub FluentUnitTestExample1
Dim Result As cFluent
Dim returnedResult As Variant
'//Arrange
Set Result = New cFluent
returnedResult = returnVal(5)
'//Act
Result.TestValue = returnedResult
'//Assert
Debug.Assert Result.Should.Be.EqualTo(5)
Debug.Assert Result.Should.Be.GreaterThan(4)
End Sub
```Or, arguably, even more naturally using cFluentOf objects like this:
```vba
Option ExplicitSub FluentUnitTestExample2()
Dim Result As cFluentOf
Dim returnedResult As Variant
'//arrange
Set Result = New cFluentOf
returnedResult = returnVal(5)
'//Act
With Result.Of(returnedResult)
'//Assert
Debug.Assert .Should.Be.EqualTo(5)
Debug.Assert .Should.Be.GreaterThan(4)
End With
'//Or like this
'//Act & Assert
Debug.Assert Result.Of(returnedResult).Should.Be.EqualTo(5)
Debug.Assert Result.Of(returnedResult).Should.Be.GreaterThan(4)
End Sub
```# Getting started
To get started with Fluent VBA you can see the [getting started page](https://github.com/b-gonzalez/Fluent-VBA/wiki/Getting-started) on the wiki.
# Contacting me
You can contact me at [email protected].
# Contributing to Fluent VBA
I'm open to external contributions for Fluent VBA. I do need to work on a style guide to determine how I'd like such contributions to be implemented. I also expect any contributions to have unit tests using the Fluent VBA library.
# Feature requests
You are free to contact me regarding feature requests as long as you understand that I'm not obligated to implement them. I expect messages to be polite, respectful, and without a sense of entitlement. As long as you do those things, I'm happy to hear what you have to say.
# Final notes
The API is in a good and usable state. Overall I'm pretty happy with the API's internal and external design. As of right now, I only anticipate internal changes and feature enhancements. So the design of the API should be relatively stable. I'd be open to changing certain design aspects of the API if I found a good reason to do so however. Naturally, this is dependant on time and availability on my part however.