bunniesandbeatings / goerkin Goto Github PK
View Code? Open in Web Editor NEWGherkin DSL for Ginkgo
Home Page: http://www.bunniesandbeatings.com/goerkin/
License: Apache License 2.0
Gherkin DSL for Ginkgo
Home Page: http://www.bunniesandbeatings.com/goerkin/
License: Apache License 2.0
Given:
define.When("I am authorized",
define.When("^I am authorized, but the next param is missing$"
Calling steps.When("I am authorized, but the next param is missing")
is matching on the first poorly terminated regex. But this was hard to discover. If we list the text of the definitions we matched upon, it will be way easier to debug
Current behavior
var _ = Describe("Too many afters", func() {
steps := NewSteps()
var (
oneCounter int = 0
twoCounter int = 0
)
Scenario("first scenario", func() {
steps.When("thing 1 is run")
})
Scenario("second scenario", func() {
steps.When("thing 2 is run")
})
steps.Define(func(define Definitions) {
define.Given(`^thing 1 is run$`, func() {
oneCounter += 1
}, func() {
oneCounter -= 1
Expect(oneCounter).To(Equal(0))
})
define.Given(`^thing 2 is run$`, func() {
twoCounter += 1
}, func() {
twoCounter -= 1
Expect(twoCounter).To(Equal(0))
})
})
})
Expects fail with
Expected
<int>: -1
to equal
<int>: 0
They should pass.
This happens because the after steps are added when the definitions are added, not when the step is encountered in a scenario.
It'd be nice if goerkin let me know, so I can make sure my test definitions are clean and not collecting old, stale definitions. In the example, the "the number is decremented" case is unused:
var _ = Describe("Number test", func() {
steps := NewSteps()
Scenario("Increment", func() {
steps.Given("the number is 1")
steps.When("the number is incremented")
steps.Then("the number is 2")
})
steps.Define(func(define Definitions) {
var number int
define.Given(`^the number is 1$`, func() {
number = 1
})
define.When(`^the number is incremented$`, func() {
number++
})
define.When(`^the number is decremented$`, func() {
number--
})
define.Then(`^the number is 1$`, func() {
Expect(number).To(Equal(2))
})
})
})
This failure https://travis-ci.com/bunniesandbeatings/goerkin/builds/108616290#L509
appears to be intermittent due to array order.
I'm not sure why the order would change, something to look into.
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.