Gauge Automation Skill
Core Patterns
Specification (specs/login.spec)
# Login Feature
## Successful Login
* Navigate to login page
* Enter email "user@test.com"
* Enter password "password123"
* Click login button
* Verify dashboard is displayed
* Verify welcome message contains "Welcome"
## Invalid Credentials
* Navigate to login page
* Enter email "wrong@test.com"
* Enter password "wrong"
* Click login button
* Verify error message "Invalid credentials" is shown
## Login with multiple users
|email |password |expected |
|-----------------|---------|----------|
|admin@test.com |admin123 |Dashboard |
|user@test.com |pass123 |Dashboard |
|bad@test.com |wrong |Error |
* Login as <email> with <password>
* Verify <expected> page is shown
Step Implementation — Java
import com.thoughtworks.gauge.Step;
import com.thoughtworks.gauge.Table;
public class LoginSteps {
WebDriver driver;
@Step("Navigate to login page")
public void navigateToLogin() {
driver.get("http://localhost:3000/login");
}
@Step("Enter email <email>")
public void enterEmail(String email) {
driver.findElement(By.id("email")).sendKeys(email);
}
@Step("Enter password <password>")
public void enterPassword(String password) {
driver.findElement(By.id("password")).sendKeys(password);
}
@Step("Click login button")
public void clickLogin() {
driver.findElement(By.cssSelector("button[type='submit']")).click();
}
@Step("Verify dashboard is displayed")
public void verifyDashboard() {
assertTrue(driver.getCurrentUrl().contains("/dashboard"));
}
}
Step Implementation — Python
from getgauge.python import step
from selenium import webdriver
@step("Navigate to login page")
def navigate_to_login():
driver.get("http://localhost:3000/login")
@step("Enter email <email>")
def enter_email(email):
driver.find_element_by_id("email").send_keys(email)
@step("Click login button")
def click_login():
driver.find_element_by_css_selector("button[type='submit']").click()
Concepts (Reusable Step Groups — specs/concepts/login.cpt)
# Login as <email> with <password>
* Navigate to login page
* Enter email <email>
* Enter password <password>
* Click login button
Setup: gauge install java (or python, js, ruby)
Init: gauge init java
Run: gauge run specs/ or gauge run specs/login.spec
Cloud Execution on TestMu AI
Set environment variables: LT_USERNAME, LT_ACCESS_KEY
// StepImplementation.java
ChromeOptions browserOptions = new ChromeOptions();
HashMap<String, Object> ltOptions = new HashMap<>();
ltOptions.put("user", System.getenv("LT_USERNAME"));
ltOptions.put("accessKey", System.getenv("LT_ACCESS_KEY"));
ltOptions.put("build", "Gauge Build");
ltOptions.put("platformName", "Windows 11");
ltOptions.put("video", true);
ltOptions.put("console", true);
browserOptions.setCapability("LT:Options", ltOptions);
Driver.setWebDriver(new RemoteWebDriver(
new URL("https://hub.lambdatest.com/wd/hub"), browserOptions));
Tags: gauge run --tags "smoke" (use Tags: smoke in spec)
Deep Patterns
See reference/playbook.md for production-grade patterns:
| Section |
What You Get |
| §1 Project Setup |
Installation, project structure, environment properties |
| §2 Spec Files |
Markdown scenarios, data tables, concepts (.cpt) |
| §3 Step Implementations |
Java steps, table-driven steps, assertions |
| §4 Hooks & Execution |
BeforeSuite/Scenario/Step, screenshots, browser logs |
| §5 Page Objects |
BasePage, concrete pages, usage in steps |
| §6 Data Management |
ScenarioDataStore, SpecDataStore, CSV data |
| §7 LambdaTest Integration |
Remote driver factory with LT:Options |
| §8 CI/CD Integration |
GitHub Actions with parallel execution, XML reports |
| §9 Debugging Table |
12 common problems with causes and fixes |
| §10 Best Practices |
14-item Gauge testing checklist |
1---2name: gauge-skill3description: Generates Gauge test specifications in Markdown with step implementations in Java, Python, JS, or Ruby. ThoughtWorks' test automation framework. Use when user mentions "Gauge", "spec file", "## Scenario", "step implementation". Triggers on: "Gauge", "Gauge spec", "Gauge framework", "ThoughtWorks test".4license: MIT5---6
7# Gauge Automation Skill
8
9## Core Patterns
10
11### Specification (specs/login.spec)
12
13```markdown
14# Login Feature
15
16## Successful Login
17* Navigate to login page
18* Enter email "user@test.com"
19* Enter password "password123"
20* Click login button
21* Verify dashboard is displayed
22* Verify welcome message contains "Welcome"
23
24## Invalid Credentials
25* Navigate to login page
26* Enter email "wrong@test.com"
27* Enter password "wrong"
28* Click login button
29* Verify error message "Invalid credentials" is shown
30
31## Login with multiple users
32|email |password |expected |
33|-----------------|---------|----------|
34|admin@test.com |admin123 |Dashboard |
35|user@test.com |pass123 |Dashboard |
36|bad@test.com |wrong |Error |
37
38* Login as <email> with <password>
39* Verify <expected> page is shown
40```
41
42### Step Implementation — Java
43
44```java
45import com.thoughtworks.gauge.Step;
46import com.thoughtworks.gauge.Table;
47
48public class LoginSteps {
49 WebDriver driver;
50
51 @Step("Navigate to login page")
52 public void navigateToLogin() {
53 driver.get("http://localhost:3000/login");
54 }
55
56 @Step("Enter email <email>")
57 public void enterEmail(String email) {
58 driver.findElement(By.id("email")).sendKeys(email);
59 }
60
61 @Step("Enter password <password>")
62 public void enterPassword(String password) {
63 driver.findElement(By.id("password")).sendKeys(password);
64 }
65
66 @Step("Click login button")
67 public void clickLogin() {
68 driver.findElement(By.cssSelector("button[type='submit']")).click();
69 }
70
71 @Step("Verify dashboard is displayed")
72 public void verifyDashboard() {
73 assertTrue(driver.getCurrentUrl().contains("/dashboard"));
74 }
75}
76```
77
78### Step Implementation — Python
79
80```python
81from getgauge.python import step
82from selenium import webdriver
83
84@step("Navigate to login page")
85def navigate_to_login():
86 driver.get("http://localhost:3000/login")
87
88@step("Enter email <email>")
89def enter_email(email):
90 driver.find_element_by_id("email").send_keys(email)
91
92@step("Click login button")
93def click_login():
94 driver.find_element_by_css_selector("button[type='submit']").click()
95```
96
97### Concepts (Reusable Step Groups — specs/concepts/login.cpt)
98
99```markdown
100# Login as <email> with <password>
101* Navigate to login page
102* Enter email <email>
103* Enter password <password>
104* Click login button
105```
106
107## Setup: `gauge install java` (or `python`, `js`, `ruby`)
108## Init: `gauge init java`
109## Run: `gauge run specs/` or `gauge run specs/login.spec`
110
111### Cloud Execution on TestMu AI
112
113Set environment variables: `LT_USERNAME`, `LT_ACCESS_KEY`
114
115```java
116// StepImplementation.java
117ChromeOptions browserOptions = new ChromeOptions();
118HashMap<String, Object> ltOptions = new HashMap<>();
119ltOptions.put("user", System.getenv("LT_USERNAME"));
120ltOptions.put("accessKey", System.getenv("LT_ACCESS_KEY"));
121ltOptions.put("build", "Gauge Build");
122ltOptions.put("platformName", "Windows 11");
123ltOptions.put("video", true);
124ltOptions.put("console", true);
125browserOptions.setCapability("LT:Options", ltOptions);
126Driver.setWebDriver(new RemoteWebDriver(
127 new URL("https://hub.lambdatest.com/wd/hub"), browserOptions));
128```
129## Tags: `gauge run --tags "smoke"` (use `Tags: smoke` in spec)
130
131## Deep Patterns
132
133See `reference/playbook.md` for production-grade patterns:
134
135| Section | What You Get |
136|---------|-------------|
137| §1 Project Setup | Installation, project structure, environment properties |
138| §2 Spec Files | Markdown scenarios, data tables, concepts (.cpt) |
139| §3 Step Implementations | Java steps, table-driven steps, assertions |
140| §4 Hooks & Execution | BeforeSuite/Scenario/Step, screenshots, browser logs |
141| §5 Page Objects | BasePage, concrete pages, usage in steps |
142| §6 Data Management | ScenarioDataStore, SpecDataStore, CSV data |
143| §7 LambdaTest Integration | Remote driver factory with LT:Options |
144| §8 CI/CD Integration | GitHub Actions with parallel execution, XML reports |
145| §9 Debugging Table | 12 common problems with causes and fixes |
146| §10 Best Practices | 14-item Gauge testing checklist |