Skip to content

joseboretto/golang-testcontainers-gherkin-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golang-testcontainers-gherkin-setup

https://medium.com/@joseboretto/integration-tests-in-go-with-cucumber-testcontainers-and-httpmock-6e771f975de9

https://dev.to/joseboretto/integration-tests-in-go-with-cucumber-testcontainers-and-httpmock-5hb9

Run locally

  1. Start docker compose
cd local
docker-compose up
  1. Set environment variables
DATABASE_USER=user
DATABASE_PASSWORD=password
DATABASE_NAME=db
DATABASE_HOST=localhost
DATABASE_PORT=5432
CHECK_ISBN_CLIENT_HOST=https://my-json-server.typicode.com/joseboretto/golang-testcontainers-gherkin-setup
  1. Run the application
cd cmd/golang-testcontainers-gherkin-setup
go run main.go

API Documentation

  1. Create book
curl --location --request POST 'http://localhost:8000/api/v1/createBook' \
--header 'Content-Type: application/json' \
--data '{
    "title": "title",
    "total_pages": 10,
    "isbn": "0-061-96436-0"
}'

External services

This is a mock server. Check https://my-json-server.typicode.com/ for more information.

  1. Check ISBN
curl --location --request GET 'https://my-json-server.typicode.com/joseboretto/golang-testcontainers-gherkin-setup/isbn/0-061-96436-1'
  1. Send email
curl --location --request GET 'https://my-json-server.typicode.com/joseboretto/golang-testcontainers-gherkin-setup/sendEmail'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published