Selenium Study Material

What is Testing

Software Testing in One Line

Software testing is checking that an application does what it should do, and finding problems (bugs) before real users find them.

Think of ShopEase, an online shop. Before a new release goes live, someone must check: can a user log in? Does search show the right products? Is the cart total correct? Does payment work? That checking is testing.

  • Verification: are we building the product right? (does it match the requirement document)
  • Validation: are we building the right product? (does it solve the user's real need)
  • Defect / bug: a difference between the expected result and the actual result.

Why Testing Matters

Bug found inApproximate cost to fixExample
Requirements1xa missing rule: "coupon cannot be used twice"
Development5xdeveloper fixes the code before merging
Testing (QA)10xtester reports it, developer fixes, tester re-tests
Production100xcustomers are charged twice; refunds, support calls, bad reviews

Note: Testing cannot prove that software has no bugs. It reduces risk. Good testers think about what can go wrong.

Expected vs Actual

Example

Every test compares an expected result with an actual result. Here is that idea in plain Java, checking a cart total:

public class Main {
    public static void main(String[] args) {
        int[] prices = {499, 1299, 250};
        int actual = 0;
        for (int price : prices) actual += price;

        int expected = 2048;
        if (actual == expected) {
            System.out.println("PASS: cart total is " + actual);
        } else {
            System.out.println("FAIL: expected " + expected + " but got " + actual);
        }
    }
}

Output

PASS: cart total is 2048