Automation for Beginners โ Starter Guide
A friendly introduction to test automation. No prior coding experience needed to read this โ but you will learn some code on the way.
Test automation means writing code that runs tests for you, instead of clicking through the app by hand.
๐ก Rule of thumb: If you will run the same test more than ~10 times, think about automating it.
| Tool | What it's for | Why it's good for beginners |
|---|---|---|
| Playwright | Web UI automation | Modern, fast, great docs, auto-waits for elements |
| Selenium | Web UI automation | The classic tool, huge community, many jobs ask for it |
| Postman | API testing | No code needed to start, click-and-test |
| Cypress | Web UI automation | Nice developer experience, JavaScript only |
| Robot Framework | Keyword-driven automation | Tests read like plain English |
Recommended path: Start with Postman (API, no code) โ then Playwright (UI, JavaScript).
This test opens a practice site, logs in, and checks that login worked.
# 1. Install Node.js from https://nodejs.org (LTS version)
# 2. Create a folder and install Playwright
mkdir my-first-automation
cd my-first-automation
npm init -y
npm install @playwright/test
npx playwright install
login.spec.js// login.spec.js
const { test, expect } = require('@playwright/test');
test('user can log in with valid credentials', async ({ page }) => {
// 1. Open the login page
await page.goto('https://www.saucedemo.com');
// 2. Fill in username and password
await page.fill('#user-name', 'standard_user');
await page.fill('#password', 'secret_sauce');
// 3. Click the login button
await page.click('#login-button');
// 4. Check that we reached the products page
await expect(page).toHaveURL(/inventory/);
await expect(page.locator('.title')).toHaveText('Products');
});
test('locked-out user sees an error message', async ({ page }) => {
await page.goto('https://www.saucedemo.com');
await page.fill('#user-name', 'locked_out_user');
await page.fill('#password', 'secret_sauce');
await page.click('#login-button');
// Check the error message is shown
const error = page.locator('[data-test="error"]');
await expect(error).toBeVisible();
await expect(error).toContainText('locked out');
});
npx playwright test # run all tests
npx playwright test --headed # watch the browser while it runs
npx playwright test --ui # interactive mode (great for learning!)
page.goto(...) โ open a URL.page.fill('#user-name', ...) โ type into a field. #user-name is a CSS selector that finds the element.page.click(...) โ click an element.expect(...) โ assertion: check that something is true. If it fails, the test fails.๐ก Finding selectors: Right-click an element on the page โ Inspect โ the DevTools show you the HTML. Look for
id,data-test, orclassattributes.
Postman lets you test APIs without code. Free download: https://www.postman.com/downloads/
Checklist โ your first API tests:
https://reqres.in/api/users?page=2 โ Status code is 200data (a list of users)https://reqres.in/api/users/2 โ User's email field is not emptyhttps://reqres.in/api/users/999 โ Status code is 404 (user not found)https://reqres.in/api/users with body {"name": "John", "job": "tester"} โ Status 201, response contains "name": "John"https://reqres.in/api/login with body {"email": "eve.holt@reqres.in", "password": "cityslicka"} โ Status 200, response contains a tokenIn Postman's "Tests" tab you can add automatic checks:
pm.test("status code is 200", function () {
pm.response.to.have.status(200);
});
pm.test("response has a token", function () {
const json = pm.response.json();
pm.expect(json.token).to.exist;
});
wait 5 seconds). Use smart waits โ Playwright waits automatically.data-test attributes over long CSS paths like div > div > div:nth-child(3).Remember: Every automation engineer started as a beginner. Manual testers who learn automation are very valuable โ you already understand testing, now you're just teaching the computer to help you. ๐ช