Code Monkey home page Code Monkey logo

goerkin's People

Contributors

squeedee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

won21kr

goerkin's Issues

Collect and show all matching strings when we hit 'too many matches'

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

After should only be added if the step is used in the current scenario

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.

List defined steps that are never used

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))
		})
	})
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.