Let's not even talk about maintaining it
# Specification name
Specification name
==================
Or
Describes a feature
Scenario name
-------------
## Scenario name
Or
Describes a acceptance criteria
Specification Level
===================
Tags: login, admin
Scenario Level
--------------
Tags: login-success, admin
Used to group runnable documentation
Concept Heading
===============
# Concept Heading
Or
Our reusable documentation
* Step Name
Our core elements
* Check "product" exists
* Check <product> exists
<Dynamic Arg>
Steps arguments
"Static Arg"
* Step that takes a table
| id | name |
|-----|---------|
| 123 | John |
| 456 | Mcclain |
|Table Parameter|
<prefix:value>
* Check if <file:/work/content.txt> is visible
file
Used as:
* Check if the users exist <table:/Users/john/work/users.csv>
table
Im a comment!!!
Comment has no syntax. Any normal line of text is treated as comment.
Specification Heading
=====================
This is an executable specification file. This file follows markdown syntax.
Every heading in this file denotes a scenario. Every bulleted point denotes a step.
To execute this specification, run
gauge specs
* Vowels in English language are "aeiou".
Vowel counts in single word
---------------------------
tags: single word
* The word "gauge" has "3" vowels.
Vowel counts in multiple word
-----------------------------
This is the second scenario in this specification
Here's a step that takes a table
* Almost all words have vowels
|Word |Vowel Count|
|------|-----------|
|Gauge |3 |
|Mingle|2 |
|Snap |1 |
|GoCD |1 |
|Rhythm|0 |
public class StepImplementation {
private HashSet<Character> vowels;
@Step("Vowels in English language are <vowelString>.")
public void setLanguageVowels(String vowelString) {
vowels = new HashSet<>();
for (char ch : vowelString.toCharArray()) {
vowels.add(ch);
}
}
@Step("The word <word> has <expectedCount> vowels.")
public void verifyVowelsCountInWord(String word, int expectedCount) {
int actualCount = countVowels(word);
assertEquals(expectedCount, actualCount);
}
@Step("Almost all words have vowels <wordsTable>")
public void verifyVowelsCountInMultipleWords(Table wordsTable) {
for (TableRow row : wordsTable.getTableRows()) {
String word = row.getCell("Word");
int expectedCount = Integer.parseInt(row.getCell("Vowel Count"));
int actualCount = countVowels(word);
assertEquals(expectedCount, actualCount);
}
}
}
Thanks!