Skip to content

Added the new TestSuiteInitializer and ScenarioInitializer#294

Merged
lonnblad merged 1 commit intomasterfrom
new-test-contexts
May 22, 2020
Merged

Added the new TestSuiteInitializer and ScenarioInitializer#294
lonnblad merged 1 commit intomasterfrom
new-test-contexts

Conversation

@lonnblad
Copy link
Copy Markdown
Member

@lonnblad lonnblad commented May 16, 2020

This PR changes the setup from this:

func FeatureContext(s *godog.Suite){
	s.BeforeSuite(func() {})
	s.AfterSuite(func() {})

	s.BeforeScenario(func(_ *messages.Pickle) {})
	s.AfterScenario(func(_ *messages.Pickle, _ error) {})

	s.BeforeStep(func(_ *messages.Pickle_PickleStep) {})
	s.AfterStep(func(_ *messages.Pickle_PickleStep, _ error) {})

	s.Step(`^(\-*\d+\.\d+) godogs$`, godogs)
}

To this:

func InitiateSuite(ctx *godog.SuiteContext){
	ctx.BeforeSuite(func() {})
	ctx.AfterSuite(func() {})
}

func InitiateScenario(ctx *godog.ScenarioContext) {
	ctx.BeforeScenario(func(_ *godog.Scenario) {})
	ctx.AfterScenario(func(_ *godog.Scenario, _ error) {})

	ctx.BeforeStep(func(_ *godog.Step) {})
	ctx.AfterStep(func(_ *godog.Step, _ error) {})
    
	ctx.Step(`^(\-*\d+\.\d+) godogs$`, godogs)
}

The solution is backwards compatible and the old solution has been marked as deprecated.

@lonnblad lonnblad requested a review from mxygem May 16, 2020 20:54
@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2020

Codecov Report

Merging #294 into master will decrease coverage by 0.84%.
The diff coverage is 57.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #294      +/-   ##
==========================================
- Coverage   84.92%   84.07%   -0.85%     
==========================================
  Files          16       17       +1     
  Lines        2500     2549      +49     
==========================================
+ Hits         2123     2143      +20     
- Misses        259      285      +26     
- Partials      118      121       +3     
Impacted Files Coverage Δ
test_context.go 14.28% <14.28%> (ø)
run.go 70.42% <42.10%> (-9.26%) ⬇️
ast.go 83.33% <66.66%> (ø)
builder.go 65.42% <82.92%> (+2.23%) ⬆️
suite.go 88.05% <100.00%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7568b29...e6227a2. Read the comment docs.

@lonnblad lonnblad force-pushed the new-test-contexts branch from 8d62d95 to 755e550 Compare May 17, 2020 06:46
@lonnblad lonnblad force-pushed the new-test-contexts branch from 755e550 to e6227a2 Compare May 18, 2020 07:48
@JannaLoeffler
Copy link
Copy Markdown

👍

Copy link
Copy Markdown
Member

@mxygem mxygem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Niiiiiice!

@lonnblad lonnblad merged commit 10728fa into master May 22, 2020
@lonnblad lonnblad deleted the new-test-contexts branch June 13, 2020 09:01
@lonnblad lonnblad restored the new-test-contexts branch October 19, 2020 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants