Cucumber is a BDD testing framework, which uses a DSL to describe wanted behaviour and can use ruby to implement the tests.
sudo apt install ruby-dev # to build cucumber
sudo gem install cucumber # apt's cucumber is v2.4, gem's is v5.2
sudo gem install rspec-expectations # makes expect() available
brew install ruby-build rbenv
rbenv install 2.7.2 # ruby 3.0 does not build cucumber yet
~/.rbenv/versions/2.7.2/bin/gem install cucumber
~/.rbenv/versions/2.7.2/bin/gem install rspec-expectations
scoop install ruby
gem install cucumber
gem install rspec-expectations
When cucumber complains about missing ANSICON, put export ANSICON=1
into your .bashrc.
.
├── cucumber.yml
├── features
│ ├── step_definitions
│ │ └── definitions.rb
│ └── tests.feature
├── README.md
└── .vscode
└── launch.json
After you have installed cucumber, you can add a test description into the features folder and run cucumber
from the command line.
To debug the tests with VSCode, install ruby-debug-ide
sudo gem install ruby-debug-ide
Then put this launch.json into the .vscode folder of your working directory
{
"configurations": [
{
"name": "Cucumber",
"type": "Ruby",
"request": "launch",
"program": "/usr/local/bin/cucumber"
}
]
}
Now you can set breakpoints in the definitions.rb and VS Code stops there if run from it.
To auto-format the definitions.rb, install rufo
and the rufo plugin for VS Code
sudo gem install rufo
To remove the ad in the footer, add a cucumber.yml with
default: --publish-quiet