TOPIC 24/4017 MINNOT STARTED

Java basics for testers: read and write a small test

Many automation tools use Java. Learn variables, methods, classes and conditions well enough to read a test and change it with care.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: a recipe card. A recipe card has a name, a list of ingredients and steps. Some steps say if the dough is dry, add water. Some say stir ten times.

A cook who can read the card can follow it or change it with care.

Java code is like a recipe card. Tom, the tester at Daily List, a to-do list app, needs to read these cards, because many test tools are written in Java.

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB Reading and changing small Java tests, like following a recipe card.

  1. Class
  2. Method
  3. Variable
  4. If
Recipe card

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
The recipe cardThe class
One recipeA method
An ingredientA variable
If dry, add waterAn if statement

WHERE THIS PICTURE STOPS

  • A recipe is for one cook, but code runs by itself.
  • A cook can guess, but the compiler cannot.
  • A recipe has a few steps, but a class may have many.

HOOK

Class, method, variable, if.

TELL A FRIEND

A recipe card: a name, ingredients, steps and ifs.

OFTEN MIXED UP WITH Programming basics for testers (read, don't build). That topic teaches programming ideas in any language. This one puts the same ideas into Java.

PRACTISE AND KEEP

Sources for this topic — 2 sources
  1. Market practice

    Language Basics (The Java Tutorials, Oracle) ↗ — Oracle · Oracle Java Tutorials: the eight primitive data types are byte, short, int, long, float, double, boolean and char, and control flow includes if-then, switch, for and while (search excerpt, page not opened)

    Covers variables, operators, expressions and control flow in Java, written for JDK (Java Development Kit) 8. Vendor tutorial. Practitioner guidance, not a standard. · Checked 2026-10-31

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  2. Market practice

    JUnit 5 user guide (JUnit documentation) ↗ — JUnit team · JUnit 5 user guide: tests are methods marked with annotations and run by the JUnit platform (search excerpt, page not opened)

    Official guide. Per the search excerpt, JUnit Jupiter is the model for writing tests in JUnit 5, the @Test annotation marks a test method, and the Assertions class holds checks. The result list showed many guide versions; the 5.14.0 page was the newest seen. Tool documentation, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page for the 5.14.0 guide as listed in a search; read as a search excerpt only. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.