theangrydev / fluent-bdd Goto Github PK
View Code? Open in Web Editor NEWA BDD framework to help write tests in a fluent way, reusing givens, whens and thens.
License: Apache License 2.0
A BDD framework to help write tests in a fluent way, reusing givens, whens and thens.
License: Apache License 2.0
Example:
given(theInventory.willReturn().aDirectoryNumber(DIR_NUM));
when(theClientRequestsADirectoryNumbersDetails());
then(theResponse).hasCode(200);
and(theResponse).containsDetails(DIR_DETAILS);
In the event that my then's have to be in a specific order and my first assertion doesn't use the then()
framework (e.g a wiremock verify
), the framework then complains that I have not provided a then()
before my and()
's.
I can imagine cutting the yatspec specific bits out and having e.g. fluent-bdd as the library name with a fluent-bdd-yatspec module and maybe more such as fluent-bdd-assertj and fluent-bdd-mockito
Searching by artifact id doesn't work well since the artifacts are named without the fluent-bdd prefix
Helper methods that integrate with the WithAssertions
AssertJ helpers
At the moment, everything has to go via FluentBdd
, but should it? This leads to some bridge methods that adapt to the FluentBdd
API, whereas maybe they should interact with Verification
directly.
It would be great to have a 60-90 second screen-cast:
Also, it would be good to have a comparison in the docs, how is this framework different/better to cucumber-jvm, jbehave, fitness, yatspec, etc.
To make it easier to depend on the whole library when you don't care about being modular
Something like then(theResult(), matches(".*blah.*"))
The current definition of mutable (only static fields) is not enough, need to expand it to something like only final fields.
Otherwise, the test will fail because it ends up in a when
state not a then
state under the hood.
The When
could be changed to just produce a Response
rather than the API being split over the request
and response
methods.
There are lots of TODOs in the code that haven't been addressed.
In practise, the thens assert on not only the response from the when, but also other state such as database interactions and wiremock verifications. There might be a better way of modelling this, because currently there will be ThenFactory
implementations that just ignore the response parameter entirely, which is a smell.
Or better if there is a way to tell the repository to redirect to the new artifact
Similar to the existing checks for givens and thens. Also, there is no point enforcing a new instance if there are no mutable fields, so that check should be added.
There are lots of TODOs in the code that haven't been addressed.
Not that important but might pick up on some unexpected things...
The return type detected by thenVerify
is Object
rather than the same T
that was passed into the method.
The problem is that givens are usually implemented as mutable builders and so using the same instance more than once can lead to accidental shared state between them. First think about whether using the same instance would ever be desirable though.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.