macros4cuke 0.1.00 → 0.1.02
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +45 -2
- data/lib/macros4cuke/constants.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -4,8 +4,51 @@ Macros4Cuke
|
|
4
4
|
## Add macros to your Cucumber feature files. ##
|
5
5
|
[Homepage](https://github.com/famished-tiger/Macros4Cuke)
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
## What is it? ##
|
8
|
+
Macros4Cuke gives you to ability to define a new Cucumber (macro-)step directly in a feature file
|
9
|
+
and to associate with it a sequence of steps to execute when the macro-step is used in
|
10
|
+
a scenario.
|
11
|
+
|
12
|
+
## How can create such a macro? ##
|
13
|
+
Here follows an example taken from our demo files:
|
14
|
+
|
15
|
+
Given I define the step "When I [enter my userid {{userid}} and password {{password}}]" to mean:
|
16
|
+
"""
|
17
|
+
Given I landed in the homepage
|
18
|
+
When I click "Sign in"
|
19
|
+
And I fill in "Username" with "{{userid}}"
|
20
|
+
And I fill in "Password" with "{{password}}"
|
21
|
+
And I click "Submit"
|
22
|
+
"""
|
23
|
+
|
24
|
+
That macro step can be used in a scenario like this:
|
25
|
+
When I [enter my userid "jdoe" and password "hello-world"]
|
26
|
+
|
27
|
+
|
28
|
+
See also the working examples in the features folder.
|
29
|
+
|
30
|
+
|
31
|
+
## What do I need to start? ##
|
32
|
+
* Install the macros4cuke gem:
|
33
|
+
- gem install macros4cuke
|
34
|
+
|
35
|
+
* In your 'env.rb' file
|
36
|
+
- 1. Load the modules and classes from the gem:
|
37
|
+
require 'macros4cuke'
|
38
|
+
|
39
|
+
|
40
|
+
- 2. Extend the world object like this:
|
41
|
+
World(Macros4Cuke::MacroStepSupport)
|
42
|
+
|
43
|
+
|
44
|
+
* In your 'step_definitions' folder
|
45
|
+
- 3. Import the macro-management steps.
|
46
|
+
Create a ruby file (say, 'use_macro_steps.rb').
|
47
|
+
Add the following line:
|
48
|
+
require 'macros4cuke/../macro_steps'
|
49
|
+
|
50
|
+
Your can start writing macros in your Cucumber project.
|
51
|
+
|
9
52
|
|
10
53
|
Copyright
|
11
54
|
---------
|