Software Testing Documentation
Manual testing and automation for QA roles — test design, test cases, bug reports, Selenium, pytest and CI.
Software testing checks that a product works as expected and finds bugs before users do. This page covers manual testing basics, test cases, bug reports and automation with Selenium, everything you need for QA and SDET interviews.
1. Introduction
| Term | Meaning |
|---|---|
| Error | A mistake made by a person |
| Defect / bug | A flaw in the software |
| Failure | The software behaving wrongly when run |
| Verification | "Are we building it right?" (reviews, no running) |
| Validation | "Are we building the right thing?" (running the product) |
| QA | Improving the process to prevent bugs |
| QC / testing | Finding bugs in the product |
Seven testing principles:
- Testing shows defects are present, not that there are none.
- Exhaustive testing is impossible.
- Test early.
- Defects cluster in a few modules.
- The same tests stop finding new bugs (the pesticide paradox).
- Testing depends on context.
- Bug-free doesn't mean useful.
2. SDLC and STLC
STLC (Software Testing Life Cycle):
Requirement analysis → Test planning → Test case design →
Environment setup → Test execution → Test closure
| Model | Testing fits in |
|---|---|
| Waterfall | After development |
| V-model | Each development phase has a matching test phase |
| Agile | Continuously, in every sprint |
3. Levels and Types of Testing
Levels:
| Level | Tests | By |
|---|---|---|
| Unit | One function or class | Developers |
| Integration | Modules working together | Developers, testers |
| System | The complete product | Testers |
| Acceptance (UAT) | Meets business needs | Clients, users |
Types:
| Type | Purpose |
|---|---|
| Smoke | Quick check that the build's main features work |
| Sanity | Quick check that a specific fix works |
| Regression | Old features still work after a change |
| Retesting | The failed test now passes after the fix |
| Functional | Features match the requirements |
| Non-functional | Performance, security, usability |
| Performance / load / stress | Speed, expected load, beyond the limit |
| Compatibility | Different browsers and devices |
| Exploratory | Test while learning, without scripts |
Black box: tester doesn't look at the code. White box: tester uses the code. Grey box: a bit of both.
4. Test Design Techniques
Equivalence partitioning: split inputs into groups that behave alike, and test one from each.
Age field accepting 18–60: test 10 (invalid), 30 (valid), 70 (invalid).
Boundary value analysis: bugs gather at the edges. Test 17, 18, 19 and 59, 60, 61.
Decision table: list combinations of conditions.
| Valid user? | Valid password? | Result |
|---|---|---|
| Yes | Yes | Log in |
| Yes | No | Error |
| No | Yes | Error |
| No | No | Error |
State transition: test moves between states, such as an account locking after 3 wrong passwords.
5. Writing Test Cases
| Field | Example |
|---|---|
| ID | TC_LOGIN_001 |
| Title | Login with a valid email and password |
| Precondition | User is registered |
| Steps | 1. Open login 2. Enter email 3. Enter password 4. Click Login |
| Test data | asha@example.com / Pass@123 |
| Expected result | Dashboard opens |
| Actual result | Filled in during execution |
| Status | Pass / Fail |
Test cases for a login page:
- Valid login; wrong password; unknown email; empty fields.
- Invalid email format; password hidden as you type.
- SQL injection text in the field; lock after repeated failures.
- "Forgot password" link; session ends after logout; browser Back after logout.
6. Bug Reports and the Bug Life Cycle
A good report lets a developer reproduce the bug in one try.
Title: Cart total is wrong after removing an item
Environment: Chrome 130, Windows 11, staging
Steps:
1. Add two items to the cart
2. Remove one item
Expected: Total updates to the remaining item's price
Actual: Total still shows both items
Severity: High Priority: High
Attachment: screenshot.png
Life cycle:
New → Assigned → Open → Fixed → Retest → Verified → Closed
↘ Rejected / Deferred / Duplicate
Retest fails → Reopened
| Severity | Priority | |
|---|---|---|
| Means | Impact on the system | How soon to fix |
| Set by | Tester | Product or project lead |
- High severity, low priority: a crash in a rarely used old report.
- Low severity, high priority: a typo in the company name on the home page.
Tools: Jira, Bugzilla, TestRail.
7. API and Database Testing
Test APIs with Postman: status codes, response fields, wrong input, missing auth and response time.
Check data with SQL:
SELECT status, total FROM orders WHERE id = 1042;
SELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) > 1;
8. Selenium WebDriver
Selenium automates a real browser. Examples use Python; Java works in the same way.
pip install selenium pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
driver.get("https://example.com/login")
driver.find_element(By.ID, "email").send_keys("asha@example.com")
driver.find_element(By.ID, "password").send_keys("Pass@123")
driver.find_element(By.CSS_SELECTOR, "button[type='submit']").click()
wait = WebDriverWait(driver, 10)
heading = wait.until(EC.visibility_of_element_located((By.TAG_NAME, "h1")))
assert "Dashboard" in heading.text
driver.quit()
Locators, best first: ID → NAME → CSS_SELECTOR → XPATH.
CSS: #email .btn-primary input[name='q']
XPath: //button[text()='Login'] //div[@class='card']//a
Waits:
| Wait | How |
|---|---|
| Implicit | One global timeout for finding elements |
| Explicit | WebDriverWait for a specific condition (preferred) |
time.sleep |
Fixed pause; avoid it |
Common mistake: using
sleepfor timing makes tests slow and flaky. Wait for a condition instead.
9. Test Frameworks and Page Object Model
import pytest
from selenium import webdriver
@pytest.fixture
def driver():
d = webdriver.Chrome()
yield d
d.quit()
class LoginPage:
URL = "https://example.com/login"
def __init__(self, driver):
self.driver = driver
def login(self, email, password):
self.driver.get(self.URL)
self.driver.find_element("id", "email").send_keys(email)
self.driver.find_element("id", "password").send_keys(password)
self.driver.find_element("css selector", "button[type='submit']").click()
def test_wrong_password_shows_error(driver):
LoginPage(driver).login("asha@example.com", "wrong")
assert "Invalid" in driver.find_element("id", "error").text
The Page Object Model keeps locators in one class per page, so a UI change means editing one place. In Java, use TestNG or JUnit. Newer tools include Playwright and Cypress.
10. Unit Testing for Developers
# test_calc.py — run with: pytest
def add(a, b):
return a + b
def test_add():
assert add(2, 3) == 5
// Jest
test('adds numbers', () => {
expect(add(2, 3)).toBe(5);
});
A mock replaces a real dependency (such as an API) with a fake. TDD means writing the failing test first, then the code. The testing pyramid recommends many unit tests, fewer integration tests and few end-to-end tests.
11. Automation in CI
Run tests on every push so bugs are caught before release:
# .github/workflows/test.yml
name: tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install -r requirements.txt
- run: pytest
Automate: stable, repeated tests such as regression and smoke suites. Keep manual: exploratory testing, usability, and features that change often.
12. Practice Problems
- Write 15 test cases for a login page, covering negative cases.
- Use boundary value analysis for an age field that accepts 18–60.
- Write a full bug report for a real bug you find on any site.
- Automate a search on a website with Selenium and assert on the results.
- Rebuild that test with the Page Object Model and pytest.
13. Interview Questions
Severity vs priority? Severity is the impact; priority is how soon to fix it.
Smoke vs sanity? Smoke is a broad check of a new build; sanity is a narrow check after a fix.
Regression vs retesting? Retesting checks the fix; regression checks that nothing else broke.
Verification vs validation? Verification checks you built it right; validation checks you built the right thing.
What is boundary value analysis? Testing at and around the limits of an input range.
Test plan vs test case? A plan covers scope, approach, schedule and risks; a case is one specific check.
When do you stop testing? When exit criteria are met, such as planned tests run, no critical bugs open, and time or budget is used.
Implicit vs explicit wait? Implicit is a global timeout; explicit waits for a specific condition.
What is the Page Object Model? A pattern that keeps each page's locators and actions in one class.
How would you test a pen / lift / ATM? Cover functionality, limits, wrong inputs, usability and safety. Interviewers want to see your structure.
14. Cheat Sheet & References
Key differences
Severity = impact · Priority = urgency
Smoke = wide + shallow · Sanity = narrow + deep
Retesting = the fix · Regression = everything else
Black box = no code · White box = with code
Techniques
Equivalence partitioning: one value per group
Boundary values: min-1, min, min+1, max-1, max, max+1
Decision table: all condition combinations
Selenium (Python)
driver.get(url)
driver.find_element(By.ID, "x").click()
el.send_keys("text"); el.text
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.ID, "x")))
driver.quit()
Life cycles
STLC: requirements → plan → design → environment → execute → close
Bug: new → assigned → open → fixed → retest → verified → closed