ddsgok / bdd Goto Github PK
View Code? Open in Web Editor NEWThis project forked from eduncan911/mspec
BDD-style Sentences for Go
License: GNU General Public License v2.0
This project forked from eduncan911/mspec
BDD-style Sentences for Go
License: GNU General Public License v2.0
Is your feature request related to a problem? Please describe.
Sometimes writing descriptions on Given, When and It sentences feels too much. I'm trying to improve documentation on a test, but the Given text ends up too large for it.
For example, when testing with hashes in passwords, I would like to write:
Given a password mynameissecret and hash asldjaskdjlakmdwldmqwd2311sdandlj
Depending on the hash size, the test wouldn't be able to print it in one line, and it would become ugly afterwards. There should be a nice way to print more information in more lines.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
I would like to have a With sentence available inside any given. With that any time i would use with function, it would print more information right below the current sentence, with detailed information.
The printed version would start with "with" word, but if there are more calls after the first with for any sentence, it would print it right below the first one, with the adequate tab, and starting with "and" word.
The code should be like this:
func Test_Sentences(t *testing.T) {
given := bdd.Sentences().Given()
given(t, "a pass password mynameissecret and otherPass password mynameisnotjonnhy", func(when bdd.When, with bdd.With) {
with("a oldHash hash asdalkdmwl31d3d2d and oldOtherHash hash qiwdno312dasd12")
with("current time being 2:00 AM from 29/05/2018")
...
when("Compare(pass, oldHash) is called")
})
}
This would print something like this:
Feature Sentences
Given a pass password mynameissecret and otherPass password mynameisnotjonnhy
with a oldHash hash asdalkdmwl31d3d2d and oldOtherHash hash qiwdno312dasd12
and current time being 2:00 AM from 29/05/2018
When Compare(pass, oldHash) is called
Is your feature request related to a problem? Please describe.
When something related to configuration fails, the program panic. The problem is that sometimes, it isn't very informative. There are also errors that are thrown unexpectedly.
For example, when the given message doesn't match one key on golden file, an index error is thrown and programs panic. There should be something more informative about this.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
I would like the configuration errors with the bdd package, have lots of information detailing error if possible. It would be something similar to how bdd package explains errors on asserts.
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.