Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/denizgursoy/cacik
Alternative cucumber support library in Go
https://github.com/denizgursoy/cacik
code-generation cucumber go golang
Last synced: about 2 months ago
JSON representation
Alternative cucumber support library in Go
- Host: GitHub
- URL: https://github.com/denizgursoy/cacik
- Owner: denizgursoy
- Created: 2023-08-22T18:34:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-02T17:31:48.000Z (over 1 year ago)
- Last Synced: 2024-11-15T22:17:09.465Z (about 2 months ago)
- Topics: code-generation, cucumber, go, golang
- Language: Go
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cacik
Cacik executes cucumber scenario with Go functions. Cacik parses go function comments stating with `@cacik` to find step
definitions.## Create files
Create your feature file and steps in a directory.
```
├── apple.feature
└── steps.go
```apple.feature
```gherkin
Feature: My first featureScenario: My first scenario
When I get 3 apples
```steps.go
```go
package mainimport (
"context"
"fmt"
)// IGetApples
// @cacik `^I have \d apples$`
func IGetApples(ctx context.Context, appleCount int) (context.Context, error) {
fmt.Printf("I have %d apples", appleCount)return ctx, nil
}```
## Install
```shell
go install github.com/denizgursoy/cacik/cmd/cacik@latest
```## Execute `cacik` to crate main.go
```shell
cacik
```Cacik will create main file
```
├── apple.feature
├── main.go
└── steps.go
```main.go
```go
package mainimport (
runner "github.com/denizgursoy/cacik/pkg/runner"
"log"
)func main() {
err := runner.NewCucumberRunner().
RegisterStep("^I have \\d apples$", IGetApples).
RunWithTags()if err != nil {
log.Fatal(err)
}
}```
## Execute main.go
To execute scenarios in the feature file, execute:
```shell
go run .
```It will print `I have 3 apples`