Test Governance Rules
Catch common test automation mistakes before they cause problems.
Why Governance?
Test code is still code. Bad patterns lead to:
- Flaky tests
- Hard-to-maintain suites
- Inconsistent practices across teams
- Technical debt that slows everyone down
AutomateX includes built-in linting rules specifically designed for test automation.
Rule Categories
Test Rules
| Rule | What It Catches |
|---|---|
no-raw-locators | Using page.locator() directly in tests instead of Page Objects |
require-assertions | Tests without expect() that can never fail |
no-hardcoded-waits | Using waitForTimeout(5000) instead of proper waits |
no-only-or-skip | Committing test.only() or test.skip() to main branch |
require-tags | Tests without tags that can't be filtered |
require-describe | Tests not organized in describe blocks |
max-test-duration | Tests with excessively long timeouts |
max-tests-per-file | Too many tests in a single file |
no-duplicate-titles | Tests with identical names |
Page Object Rules
| Rule | What It Catches |
|---|---|
require-base-page | Page classes not extending BasePage |
require-url | Pages missing URL property |
locator-naming | Locators not declared as readonly |
no-hardcoded-selectors | Magic strings instead of named locators |
File & Structure Rules
| Rule | What It Catches |
|---|---|
file-naming | Inconsistent naming (camelCase vs kebab-case) |
folder-structure | Missing required directories |
max-file-lines | Excessively long files |
Security Rules
| Rule | What It Catches |
|---|---|
no-hardcoded-credentials | Passwords or API keys in test code |
no-console-log | Console statements left in tests |
no-sensitive-data | PII patterns in test files |
Auto-Fix Support
Many rules support automatic fixing:
| Rule | Auto-Fix |
|---|---|
no-only-or-skip | Removes .only and .skip |
no-console-log | Removes console statements |
file-naming | Suggests corrected names |
no-hardcoded-waits | Suggests replacement patterns |
Presets
Pre-configured rule sets for different needs:
| Preset | Strictness | Use Case |
|---|---|---|
recommended | Medium | Most teams |
strict | High | Quality-focused teams |
enterprise | Maximum | Regulated industries |
Enforce Best Practices
Request early access to add governance to your test suite.