-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f5662d
commit 34dde0e
Showing
9 changed files
with
399 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"position": 5, | ||
"position": 6, | ||
"label": "Terminology" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"position": 5, | ||
"label": "Tools" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import DocCardList from '@theme/DocCardList'; | ||
|
||
# Tools | ||
|
||
Using Cucumber in your project is more manageable with the right tools. | ||
|
||
## Editors | ||
|
||
Most popular text editors support Gherkin syntax highlighting. | ||
|
||
Some IDEs also have advanced support for Cucumber, such as running Cucumber | ||
from within the IDE, displaying results, navigating between Gherkin steps and | ||
step definitions and so on. | ||
|
||
### Atom | ||
|
||
[Atom](https://github.com/atom/atom) is a text editor for macOS, Windows or Linux. | ||
|
||
It offers several [packages](https://atom.io/packages/search?q=cucumber) you can use with Cucumber. | ||
|
||
### TextMate | ||
|
||
[TextMate](https://macromates.com/) is a text editor for macOS. | ||
See the [`Cucumber.tmbundle`](https://github.com/cucumber/cucumber-tmbundle) documentation. | ||
|
||
### Visual Studio Code | ||
|
||
[Visual Studio Code](https://code.visualstudio.com/) is a code editor for Windows, Linux, or macOS. | ||
|
||
You can use it with a [Cucumber (Gherkin) plugin](https://marketplace.visualstudio.com/items?itemName=alexkrechik.cucumberautocomplete). | ||
|
||
### Nova | ||
|
||
[Nova](https://nova.app) is a text editor for macOS. | ||
|
||
See the [Cucumber extension](https://extensions.panic.com/extensions/com.rpowell/com.rpowell.Cucumber/) for Gherkin language support. | ||
|
||
## IDEs | ||
|
||
* [Java IDEs](./java.md#ides) | ||
* [Ruby IDEs](./ruby.md#ides) | ||
* [CukeTest](http://cuketest.com) is a Gherkin editor and Cucumber.js development tool. | ||
* [testjam.io](https://testjam.io) is an online IDE for running and sharing Cucumber.js snippets. | ||
|
||
## Build tools | ||
|
||
You can run Cucumber using build tools, rather than from the command line. | ||
|
||
* [Java build tools](./java.md#build-tools) | ||
* [Ruby build tools](./ruby.md#build-tools) | ||
|
||
## More | ||
|
||
<DocCardList /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Java | ||
|
||
This page describes tools commonly used with Java. | ||
|
||
## IDEs | ||
|
||
### IntelliJ IDEA | ||
|
||
- [IntelliJ IDEA](https://www.jetbrains.com/idea/) has the [IntelliJ IDEA Cucumber for Java plugin](https://plugins.jetbrains.com/plugin/7212-cucumber-for-java) | ||
|
||
You can find more information on using Cucumber with IntelliJ IDEA in the [IntelliJ IDEA Cucumber help pages](https://www.jetbrains.com/idea/help/cucumber.html) | ||
|
||
### Eclipse | ||
|
||
- [Eclipse](https://www.eclipse.org/) has the [Cucumber Eclipse plugin](https://cucumber.github.io/cucumber-eclipse/) | ||
|
||
## Build tools | ||
|
||
The most widely used build tools for Java are [Maven](#maven) and [Gradle](#gradle). | ||
|
||
### Maven | ||
|
||
To run Cucumber with [Maven](https://maven.apache.org/), make sure that: | ||
|
||
- Maven is installed | ||
- The environment variable `MAVEN_HOME` is correctly configured | ||
- The IDE is configured with the latest Maven installation | ||
|
||
Clone the [cucumber-java-skeleton](https://github.com/cucumber/cucumber-java-skeleton) to get started. | ||
|
||
### Gradle | ||
|
||
To run Cucumber with [Gradle](https://gradle.org/), make sure that: | ||
|
||
- Gradle is installed | ||
- The environment variable `GRADLE_HOME` is correctly configured | ||
- The IDE is configured with the latest Gradle installation | ||
|
||
Clone the [cucumber-java-skeleton](https://github.com/cucumber/cucumber-java-skeleton) to get started. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# JavaScript | ||
|
||
This page describes tools commonly used with JavaScript. | ||
|
||
## Build tools | ||
|
||
The most widely used build tools for JavaScript are [npm](#npm) and [Yarn](#yarn). | ||
|
||
### npm | ||
|
||
To use Cucumber with [npm](https://www.npmjs.com/), make sure that: | ||
|
||
- Node.js is installed | ||
- npm is installed | ||
|
||
Cucumber.js is available as an npm module. | ||
|
||
Add `@cucumber/cucumber` as a development dependency: | ||
|
||
```shell | ||
npm install --save-dev @cucumber/cucumber | ||
``` | ||
|
||
### Yarn | ||
|
||
To run Cucumber with [Yarn](https://yarnpkg.com/en/), make sure that: | ||
|
||
- Node.js is installed | ||
- Yarn is installed | ||
|
||
Add `@cucumber/cucumber` as a development dependency: | ||
|
||
```shell | ||
yarn add --dev @cucumber/cucumber | ||
``` |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Ruby | ||
|
||
This page describes tools for a Ruby or Ruby on Rails environment. | ||
|
||
## IDEs | ||
|
||
### RubyMine | ||
|
||
[RubyMine](https://www.jetbrains.com/help/ruby/meet-rubymine.html) is a Ruby and Rails IDE. | ||
|
||
## Build tools | ||
|
||
Cucumber can be run in several ways. | ||
Be aware that `rake cucumber`, `cucumber features`, and `autotest` with `ENV AUTOFEATURE=true` do not necessarily produce | ||
the same results given the same features and step definitions. | ||
|
||
### Rake | ||
|
||
Running `rake cucumber` from the command line provides the simplest method to run Cucumber tests. | ||
|
||
Using Rake requires a `Rakefile` with a `features` task definition. For example: | ||
|
||
```ruby | ||
require 'rubygems' | ||
require 'cucumber' | ||
require 'cucumber/rake/task' | ||
|
||
Cucumber::Rake::Task.new(:features) do |t| | ||
t.cucumber_opts = "--format pretty" # Any valid command line option can go here. | ||
end | ||
``` | ||
|
||
This will run all the Features with the pretty formatter. | ||
|
||
Note, how we use the `cucumber_opts` accessor to define our arguments passed to Cucumber. | ||
|
||
If you are using [Ruby on Rails](#ruby-on-rails), this task is defined for you already. | ||
|
||
Now you can run Cucumber with Rake: | ||
|
||
```shell | ||
rake features | ||
``` | ||
|
||
The rake script provided with Cucumber performs much of the background magic required to get the test database and requisite | ||
libraries properly loaded. | ||
In fact, an important habit to acquire is to run Cucumber as a `rake` task immediately after performing a migration. | ||
This ensures that the test database schema is kept in sync with the development database schema. | ||
You can achieve the same effect by running `rake db:test:prepare` before your first Cucumber run following a migration | ||
but developing the habit of running `rake cucumber` or `rake cucumber:wip` is probably the better course. | ||
|
||
The Cucumber Rake task recognises the `@wip` Tag, so `rake cucumber:wip` will run only those scenarios tagged with **@wip**. | ||
|
||
For example, given a feature file containing: | ||
|
||
```gherkin | ||
Feature: . . . | ||
Scenario: A | ||
@wip | ||
Scenario: B | ||
Scenario: C | ||
``` | ||
|
||
Then running the command `rake cucumber:wip` will run the Steps contained inside Scenario B only, | ||
while running `rake cucumber:ok` will run the Steps within all Scenarios other than B. | ||
|
||
#### Using profiles in Rake tasks | ||
|
||
For complex Feature runs that are tested often, it is nice to save the command line arguments as [Cucumber profiles](/docs/cucumber/configuration#profiles). | ||
|
||
Once you have some profiles defined, you can use them in your Rake tasks, like so: | ||
|
||
```ruby | ||
require 'rubygems' | ||
require 'cucumber' | ||
require 'cucumber/rake/task' | ||
|
||
namespace :features do | ||
Cucumber::Rake::Task.new(:non_js) do |t| | ||
t.profile = "webrat" | ||
end | ||
|
||
Cucumber::Rake::Task.new(:selenium) do |t| | ||
t.profile = "selenium" | ||
end | ||
end | ||
``` | ||
|
||
#### Guarding your production machines From Cucumber | ||
|
||
Since Rake tasks are used on development and productions systems, it is generally a good idea to place a guard around your Cucumber task so your productions boxes don't need to install Cucumber. | ||
|
||
Below is an example of how to do this. This example is the Rake task that Cucumber generates for Rails projects, but the same idea applies to any project using Cucumber and Rake: | ||
|
||
```ruby | ||
require 'rubygems' | ||
|
||
begin | ||
require 'cucumber' | ||
require 'cucumber/rake/task' | ||
|
||
Cucumber::Rake::Task.new(:features) do |t| | ||
t.cucumber_opts = "--format pretty" | ||
end | ||
|
||
task features: 'db:test:prepare' | ||
rescue LoadError | ||
desc 'Cucumber rake task not available' | ||
task :features do | ||
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' | ||
end | ||
end | ||
``` | ||
|
||
### Ruby on Rails | ||
|
||
#### cucumber-rails | ||
|
||
[cucumber-rails](https://github.com/cucumber/cucumber-rails) is a RubyGem which | ||
brings Ruby on Rails Generators for Cucumber with special support for Capybara | ||
and DatabaseCleaner. | ||
|
||
##### Installing | ||
|
||
The `cucumber:install` generator sets up Cucumber in your Rails project. It | ||
generates the necessary files in the `features/` directory. After | ||
running this generator you will also get a new rake task called `cucumber`. | ||
|
||
For more details, see `rails generate cucumber:install --help`. | ||
|
||
##### Usage | ||
|
||
By default, `cucumber-rails` runs `DatabaseCleaner.start` and | ||
`DatabaseCleaner.clean` before and after your Cucumber scenarios. This default | ||
behavior can be disabled. See the | ||
[cucumber-rails README](https://github.com/cucumber/cucumber-rails) for details. | ||
|
||
##### Resources | ||
|
||
To learn more of the tools being integrated and assisted by `cucumber-rails`, | ||
see the READMEs of | ||
[DatabaseCleaner](https://github.com/DatabaseCleaner/database_cleaner) and | ||
[Capybara](https://github.com/teamcapybara/capybara). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters