File: step_definitions.go

package info (click to toggle)
golang-github-gucumber-gucumber 0.0~git20180127.7d5c79e-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 180 kB
  • sloc: makefile: 10
file content (49 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package basic

import (
	. "github.com/gucumber/gucumber"
	"github.com/stretchr/testify/assert"
)

func init() {
	executions := 100
	result := 1
	beforeAllCalls := 0

	BeforeAll(func() {
		beforeAllCalls++
	})

	Before("@basic", func() {
		executions = 0
	})

	Given(`^I have an initial step$`, func() {
		assert.Equal(T, 1, 1)
	})

	And(`^I have a second step$`, func() {
		assert.Equal(T, 2, 2)
	})

	When(`^I run the "(.+?)" command$`, func(s1 string) {
		assert.Equal(T, "gucumber", s1)
	})

	Then(`^this scenario should execute (\d+) time and pass$`, func(i1 int) {
		executions++
		assert.Equal(T, i1, executions)
	})

	Given(`^I perform (\d+) \+ (\d+)$`, func(i1 int, i2 int) {
		result = i1 + i2
	})

	Then(`^I should get (\d+)$`, func(i1 int) {
		assert.Equal(T, result, i1)
	})

	Then(`^setup was called (\d+) times?$`, func(i2 int) {
		assert.Equal(T, i2, beforeAllCalls)
	})
}