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