Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
#git_dir is path to default git folder with repository
.PHONY: tests

# git_dir is path to default git folder with repository
git_dir=./.git

#github_actions_dir is path to github actions directory with workflow
# github_actions_dir is path to github actions directory with workflow
github_actions_dir=./.github

#features_dir is path to directory with features
# features_dir is path to directory with features
features_dir=./features

#gitignore_path is path to .gitignore file
# gitignore_path is path to .gitignore file
gitignore_path=./.gitignore

#assets_dir is path to directory with temporary assets
# assets_dir is path to directory with temporary assets
assets_dir=./assets

#env creates .env file and populates it with default values
# env creates .env file and populates it with default values
env:
touch .env
echo "GODOG_DEBUG=false\nGODOG_MY_APP_URL=http://localhost:1234\nGODOG_JSON_SCHEMA_DIR=./assets/test_server/doc/schema" >> .env

#download-dependencies download go packages and godog binary
# download-dependencies download go packages and godog binary
download-dependencies:
go mod download
go install github.com/cucumber/godog/cmd/godog@v0.12.4

#clean removes directories with binaries, git repository, github actions workflow and test suite
# clean removes directories with binaries, git repository, github actions workflow and test suite
clean:
rm -rf ${git_dir}
rm -rf ${github_actions_dir}
rm -rf ${assets_dir}
rm -rf ${features_dir}
rm ${gitignore_path}
rm ${gitignore_path}

# tests run all tests concurrently, server should be run manually
tests:
godog --format=progress --concurrency=2 --random
21 changes: 10 additions & 11 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
![godog-example-setup](https://github.com/pawelWritesCode/godog-example-setup/actions/workflows/go.yml/badge.svg)

# Example godog framework setup with step library gdutils
# Godog framework developed to test HTTP(s) API.

## Overview:

This repository contains skeleton that allow to write End-2-End tests for HTTP API with use of framework [godog](https://github.com/cucumber/godog)
that implements 🥒[gherkin/cucumber](https://cucumber.io/docs/gherkin/) syntax using step library [gdutils](https://github.com/pawelWritesCode/gdutils).
This repository contains skeleton that allow to write End-2-End tests for HTTP(s) API with use of framework [godog](https://github.com/cucumber/godog)
that implements 🥒[cucumber/gherkin](https://cucumber.io/docs/gherkin/) syntax using step library [gdutils](https://github.com/pawelWritesCode/gdutils).

## Why ?
**No more** long and time-consuming framework setup. This project **cuts initial time** & allows bootstrap e2e test framework with **plenty of
utility methods** (_for testing HTTP(s) API using JSON/YAML/XML_) in just few steps. Just grab it and write tests right away.
This project **cuts initial time** & allows bootstrap e2e test framework with **plenty of
utility methods** in just few steps. Just grab it and write tests right away!

Benefits:
* **short time** from **[setup](https://github.com/pawelWritesCode/godog-example-setup/wiki/Set-up#clone-repository) - to writing** actual E2E tests,
* [35+ well-documented, coupled in logical groups steps](https://github.com/pawelWritesCode/godog-example-setup/wiki/Steps) useful for testing HTTP(s) API,
* support for using templated values as in [text/template](https://pkg.go.dev/text/template) package,
* support for querying nodes with different path engines ([oliveagle](https://github.com/oliveagle/jsonpath), [qjson](https://github.com/pawelWritesCode/qjson) - JSON, [go-yaml](https://github.com/goccy/go-yaml) - YAML, [antchfx](https://github.com/antchfx/xmlquery) - XML),
* support for sending _multipart/form-data_ forms with file in it,
* rich debugging possibilities - various ways to debug tests,
* customisable - ability to [replace](https://github.com/pawelWritesCode/godog-example-setup/blob/main/main_test.go#L58) utility services with your own implementations,
* supports custom [steps development](https://github.com/pawelWritesCode/godog-example-setup/wiki/Steps-development) through [exported utility services](https://github.com/pawelWritesCode/gdutils/blob/master/state.go#L18).
* support for sending _multipart/form-data_ forms with file in it,
* developed with debugging in mind,
* customisable through ability to [replace](https://github.com/pawelWritesCode/godog-example-setup/blob/main/main_test.go#L58) utility services with your own implementations,
* supports [custom steps development](https://github.com/pawelWritesCode/godog-example-setup/wiki/Steps-development).

## Example

#### [Click here 👆 to see more tests using JSON/YAML/XML](https://github.com/pawelWritesCode/godog-example-setup/blob/main/features/test_server)
#### [👆 Click here to see more tests using JSON/YAML/XML](https://github.com/pawelWritesCode/godog-example-setup/blob/main/features/test_server)

```cucumber
Feature: Adding new user
Expand Down
Loading