Use Gherkin to write plain-text, human-readable test cases for your PostgreSQL data:
Feature: PostgreSQL admin user permissions
Scenario: The user admin is a superuser on the pgcumber database
Given The host "localhost"
And The port "5432"
And The database "pgcumber"
When I use username "admin"
And I use password "admin"
And I connect to the server
Then the connection is successful
And I am a database superuserand test it against your PostgreSQL database using pgcumber:
pgcumber features/user/admin.featureTake a look at the available Steps and the Features to have a better understanding.
Use homebrew to install pgcumber on macOS or Linux.
Or just download the binary from the releases page for your operating system and architecture.
You can install the homebrew formula, which builds the binary from the source code.
First add one tap to homebrew:
brew tap pgcumber/formulaThen you have to trust the homebrew tap:
brew trust pgcumber/formulaThen you can install the command:
brew install pgcumberUse pgcumber and add the feature file:
pgcumber features/user/admin.featureor directory path as argument:
pgcumber features/Warning
If you use macOS and you download the binary, you might need remove to the assigned quarantine attribute:
xattr -d com.apple.quarantine pgcumberThis is not necessary if you install pgcumber with homebrew which build it from the source.
You can also use the Docker image from Docker Hub to run pgcumber as container:
docker run \
--interactive \
--tty \
--rm \
--volume "$(pwd)/features:/data/pgcumber/features" \
--network host \
arkadiusjonczek/pgcumber /data/pgcumber/featuresUse the docker compose file docker-compose.yaml to start PostgreSQL:
docker-compose up -dThen use pgcumber and the feature file features/user/admin.feature:
pgcumber features/pgcumber.featureAfter your tests you can stop the docker environment again:
docker-compose downThe implementation is based on godog which is cucumber for golang.