# How to prove your app works: testing for beginners

> What software testing is, how to test an app by hand, how to write your first automatic checks in JavaScript, and why tests matter more when AI writes code.

- URL: https://genkid.app/blog/testing-for-beginners
- Topic: Building with AI
- Published: 2026-10-29 (updated 2026-11-15)
- Publisher: GenKid (https://genkid.app)

## Key takeaways

- Testing means checking that your app does what it should — and doesn't do what it shouldn't.
- Start with manual tests: the normal path, then edge cases like empty, zero, huge or repeated inputs.
- Automatic checks are small pieces of code that test your code, so you can re-run them after every change.
- Tests are especially important with AI, because AI changes can quietly break things that used to work.
- Never change a test just to make it pass; a failing test is information.

## What testing is

Testing is how you find out whether your app really works. It sounds obvious, but most bugs survive because nobody tried the thing that breaks them.

England's computing curriculum asks pupils from primary school to design, write and *debug* programs, and to use logical reasoning to detect and correct errors. Testing is how you find those errors before someone else does.

## Start with manual testing

Manual testing means using the app yourself, deliberately. Do it in two passes.

### Pass 1: the happy path
Use each feature the normal way. Click the buttons, fill in the boxes, play the game. Does everything do what it should?

### Pass 2: try to break it
Now be mischievous. Try:

- **Empty** — submit nothing.
- **Zero and negative** — 0, -1.
- **Huge** — a very long name, a very big number.
- **Weird** — spaces only, emoji, symbols.
- **Repeated** — click the button ten times fast.
- **Boundaries** — the last question, the maximum score, exactly the limit.

Write down anything that goes wrong, with the steps to make it happen. That's a bug report, and it's the start of [debugging](https://genkid.app/blog/debugging-for-beginners).

## Write your first automatic checks

Manual testing is great, but slow to repeat. Automatic checks are small bits of code that test your code. Here's a tiny check helper in JavaScript:

```js
function check(label, actual, expected) {
  if (actual === expected) {
    console.log("PASS " + label);
  } else {
    console.log("FAIL " + label + ": got " + actual + ", expected " + expected);
  }
}
```

Now test a function from a dragon egg game, where an egg hatches when its warmth reaches 5:

```js
function isHatched(egg) {
  return egg.warmth >= 5;
}

check("warmth 5 hatches", isHatched({ warmth: 5 }), true);
check("warmth 4 does not hatch", isHatched({ warmth: 4 }), false);
check("warmth 0 does not hatch", isHatched({ warmth: 0 }), false);
```

Run the app and read the console. In most desktop browsers you open it with `F12` or `Ctrl` + `Shift` + `I` (`Cmd` + `Option` + `I` on a Mac), then choose the **Console** tab. In GenKid's workspace, `console.log` messages appear in the console panel next to your app. (Not sure what the console is for? See [HTML, CSS and JavaScript explained](https://genkid.app/blog/html-css-javascript-explained).)

Every time you (or an AI) change the code, run the checks again. If something that used to pass now fails, you've caught a bug immediately.

Professional developers do the same thing with testing frameworks, which add helpful features but work on the same idea.

## Why testing matters more with AI

When an AI changes your code, it can fix one thing and break another without telling you. It may also be confident its change works when it doesn't. Tests give you an independent answer.

A few rules for testing with AI:

- **Write or agree the tests before the AI builds the feature.** Tests describe what "works" means.
- **Run them after every AI change.** See [how to check code an AI wrote](https://genkid.app/blog/how-to-review-ai-generated-code).
- **Never let the AI "fix" a failing test by changing the test**, unless you agree the test itself was wrong. A failing test is telling you something. Watch for this especially with [AI coding agents](https://genkid.app/blog/what-is-an-ai-coding-agent), which can edit many files, tests included, in one go.
- **Ask the AI to suggest edge cases**, but decide yourself which ones matter.

## What to test first

You can't test everything, so test what matters most:

| Priority | Examples |
|---|---|
| Rules of the app | Scoring, winning, prices, limits |
| Anything with user input | Names, answers, forms |
| Things that broke before | Every bug you fixed deserves a test |
| Boundaries | First, last, empty, maximum |

## Testing is a mindset

A habit that helps: before you run your checks, predict which ones will pass. It's the same "predict, then run" step behind [reading code before writing it](https://genkid.app/blog/primm-read-code-before-writing), and it trains you to notice when something surprises you.

Testers ask "how could this go wrong?" That mindset is valuable everywhere: checking an essay, planning a trip or judging whether an AI's answer is true. It's part of thinking critically, not just coding.

GenKid includes testing from Level 2: learners write checks that define what "works" means, then use them to find bugs in AI-written code — including a final bug the checks themselves uncover. See the [pathway](https://genkid.app/pathway).

## Frequently asked questions

### What is a unit test?

A unit test is a small automatic check that tests one small piece of code, such as one function, with known inputs and expected outputs.

### How many tests should I write?

Enough to cover the main rules of your app, the edge cases and every bug you've fixed. For a small app, a handful of well-chosen checks is a great start.

### What's an edge case?

An unusual input or situation at the limits of what your app expects, such as an empty name, zero, a huge number or the last item in a list. Bugs often hide there.

### Can AI write my tests?

AI can suggest tests, but you should decide what "correct" means and check the tests are right. If the AI writes both the code and the tests, they can share the same mistake.

## Sources

- [National curriculum in England: computing programmes of study](https://www.gov.uk/government/publications/national-curriculum-in-england-computing-programmes-of-study/national-curriculum-in-england-computing-programmes-of-study) — Department for Education
- [What are browser developer tools?](https://developer.mozilla.org/en-US/docs/Learn_web_development/Howto/Tools_and_setup/What_are_browser_developer_tools) — MDN Web Docs
