Automation Testing
Automation Testing

Automation testing is where QA shifts from manually repeating checks to using code and tools to validate software quickly, consistently, and repeatedly.

1. What is Automation Testing?

Automation testing means:

Using scripts, frameworks, and tools to execute tests automatically and compare actual vs expected results.

Instead of manually:

 
Open login page
Enter username
Enter password
Click Login
Verify dashboard
 

Automation runs it automatically.

Benefits:

✓ Faster execution
✓ Repeatable
✓ Better regression coverage
✓ Reduced human error
✓ Supports CI/CD pipelines
✓ Faster release cycles

Not everything should be automated.

Good candidates:

  • Regression tests
  • Smoke tests
  • API validation
  • Stable functionality
  • Data-driven scenarios
  • Cross-browser validation

Poor candidates:

  • Rapidly changing UI
  • One-off tests
  • Exploratory testing
  • Usability testing

2. Automation Testing Pyramid

Common strategy:

 
        UI Tests
(Slow/Fewer)
/\
/ \
API /____\ Tests
(Medium)

Unit Tests
(Fast/Many)
 

Approximate split:

  • Unit tests → 70%
  • API tests → 20%
  • UI automation → 10%

Reason:

UI tests:

  • Slower
  • Flaky
  • Maintenance heavy

API tests:

  • Faster
  • Stable
  • Better ROI

3. Selenium

Selenium Official Site

Selenium is:

An open-source browser automation framework.

Supports:

  • Chrome
  • Edge
  • Firefox
  • Safari

Languages:

  • Java
  • C#
  • Python
  • JavaScript
  • Ruby

Architecture:

 
Test Script

WebDriver API

Browser Driver

Browser
 

Example Selenium flow:

 
driver.get("https://site.com");

driver.findElement(By.id("email"))
.sendKeys("test@test.com");

driver.findElement(By.id("login"))
.click();

assertEquals("Dashboard",
driver.getTitle());
 

Strengths:

✓ Mature ecosystem
✓ Large community
✓ Multiple languages
✓ Enterprise adoption

Weaknesses:

✗ Slower setup
✗ WebDriver dependency
✗ More flaky if poorly designed

Common framework structure:

 
Tests/
Pages/
Utilities/
Data/
Reports/
 

Usually implemented with:

  • Page Object Model (POM)
  • TestNG / JUnit
  • Maven / Gradle
  • CI/CD integration

4. Playwright

Playwright Official Site

Playwright is newer and increasingly popular.

Created by engineers formerly involved with Selenium and browser tooling.

Supports:

  • Chromium
  • Firefox
  • WebKit

Languages:

  • TypeScript
  • JavaScript
  • Python
  • Java
  • .NET

Example:

 
await page.goto('/login');

await page.fill(
'#email',
'test@test.com'
);

await page.fill(
'#password',
'password123'
);

await page.click(
'button[type=submit]'
);

await expect(page)
.toHaveURL('/dashboard');
 

Major advantages:

✓ Faster execution
✓ Built-in waiting
✓ Auto retries
✓ Better stability
✓ Parallel execution
✓ Network interception
✓ Mobile emulation

Playwright automatically waits:

Instead of:

 
sleep(5000)
 

Playwright waits intelligently.

Example:

 
await page.click()
 

Waits for:

  • Visible
  • Stable
  • Clickable

Less flaky.


5. Cypress

Cypress Official Site

Cypress focuses heavily on frontend testing.

Supports:

  • JavaScript
  • TypeScript

Example:

 
cy.visit('/login')

cy.get('#email')
.type('test@test.com')

cy.get('#login')
.click()

cy.url()
.should(
'contain',
'dashboard'
)
 

Strengths:

✓ Easy setup
✓ Excellent developer experience
✓ Fast feedback
✓ Great debugging tools
✓ Automatic waiting

Limitations:

Historically:

✗ Multi-tab limitations
✗ Browser support constraints (improved significantly)
✗ Mostly JavaScript ecosystem

Very popular in React/Angular/Vue teams.


6. Selenium vs Playwright vs Cypress

Feature Selenium Playwright Cypress
Browser support Excellent Excellent Good
Speed Medium Fast Fast
Setup complexity Higher Medium Easy
Auto wait Limited Excellent Excellent
Language support Many Many JS/TS mainly
Parallel execution Extra config Built-in Supported
Mobile emulation Limited Strong Moderate
Flakiness More risk Lower Lower
Enterprise maturity Very high Growing rapidly High

Current industry trend:

Legacy enterprise:

→ Selenium

Modern engineering teams:

→ Playwright

Frontend-heavy teams:

→ Cypress


7. API Automation Testing

UI tests validate:

"Can user click buttons?"

API tests validate:

"Does backend behave correctly?"

API automation is often higher value.

Example endpoint:

 
POST /login
 

Request:

 
{
"email":"user@test.com",
"password":"password123"
}
 

Expected response:

 
{
"token":"abc123",
"status":"success"
}
 

Validate:

  • Status code
  • Response body
  • Headers
  • Schema
  • Response time
  • Error handling

8. API Automation Tools

Postman

Postman Official Site

Example checks:

 
pm.test(
"Status code 200",
function () {
pm.response.to.have.status(200)
})
 

Validate:

✓ Response time
✓ Body values
✓ Headers
✓ Auth


REST Assured (Java)

REST Assured Official Site

Example:

 
given()
.body(payload)

.when()
.post("/login")

.then()
.statusCode(200)
.body(
"status",
equalTo("success")
);
 

Very common enterprise API framework.


Playwright API Testing

Playwright also supports APIs:

 
const response =
await request.post(
'/login',
{
data:{
email:'test',
password:'123'
}
}
)

expect(
response.status()
).toBe(200)
 

Single framework:

UI + API.


9. CI/CD Integration

Automation becomes powerful when integrated into pipelines.

Example pipeline:

 
Developer commit

Build

Unit Tests

API Automation

UI Smoke Automation

Deploy QA

Regression Automation

Deploy Production
 

Common tools:

  • Jenkins
  • GitHub Actions
  • Azure DevOps
  • GitLab CI

10. Automation Framework Design Principles

Good framework:

DRY

Don't Repeat Yourself

Bad:

 
login code repeated 20 times
 

Good:

 
loginPage.login()
 

Page Object Model (POM)

Structure:

 
Pages/
LoginPage.js

Tests/
LoginTest.js
 

UI selectors isolated.

Benefits:

✓ Easier maintenance
✓ Cleaner code
✓ Reduced duplication


Data Driven Testing

Example:

Single test:

 
username,password,result

user1,pass1,PASS
user2,badpass,FAIL
 

Avoid duplicate scripts.


11. Flaky Tests (Big Automation Problem)

Flaky test:

Passes sometimes, fails sometimes.

Causes:

  • Hard waits
  • Timing issues
  • Unstable environments
  • Dynamic selectors
  • Test data dependency

Bad:

 
sleep(10000)
 

Better:

 
waitForElementVisible()
 

Playwright reduces flakiness substantially.


12. Senior QA mindset for automation

Poor automation:

"Automate everything."

Strong automation strategy:

"Automate high-value, stable, repeatable tests and keep exploratory/manual testing where human insight matters."

Modern QA teams commonly aim for:

  • API-heavy automation
  • Lean UI automation
  • Exploratory testing alongside automation
  • CI/CD integration
  • Accessibility automation where possible

Next logical topic for your QA + a11y path: Accessibility automation (axe-core, Lighthouse, Playwright accessibility testing, keyboard automation, WCAG validation).

Everything Testing
About Everything Testing

QA Tips - helpful tips, articles, and guidance.

  • Helpful tips
  • Articles
  • Guides
  • Resources

Tips and articles made simple

About Everything Testing