unit teszt
in English: unit test
A unit test is a short checking program that shows separately whether a small part of a software does what we expect from it.
In plain terms
Imagine you are assembling a car. Before installing each part, you test it separately: does the bulb light up, does the valve close, does the bearing rotate? A unit test is the same in software: it examines a tiny part of the program in isolation from the rest.
The test itself is code. It provides an input, runs the part under examination, then compares the result with what should come out. If they match, the test is "green"; if not, it is "red," showing which check failed and how the result differs from the expected one.
The real benefit comes later: if someone rewrites the program, the hundreds or thousands of tests typically rerun in seconds or minutes and signal if a part that previously worked has broken. This is why it became especially important in the era of coding agents: the agent checks its own work by running the tests, and this also gives you a foothold to verify that the code written by the machine actually works in the tested cases.
How it works
- The developer or coding agent selects a small unit, typically a single function, such as one that calculates net from gross price.
- It writes a test for it: it provides the input (12,700 forints, 27 percent VAT) and the expected result (10,000 forints).
- The test runner program starts the unit and compares the actual output with the expected one; external dependencies (database, network) are often replaced with mocks so that only the specific part is the subject of the test.
- The result is immediately visible: success or failure, with the exact deviation in case of an error.
- Tests are then automatically re-run with every modification, so errors are detected minutes after they occur, not weeks later with the customer.
An everyday example
You ask a coding agent to fix a bug in your online store's discount calculation. The agent first writes a test that checks the faulty case, then after the fix runs all tests and reports back: '143 tests passed, 0 failed'. From this you see that the faulty case now works well and the rest of the cart's calculations covered by tests have not broken. However, this does not prove that the program is flawless in every situation.
Who is affected
A common misconception
Limits and risks
- It only examines individual parts separately, so even if every component is good, the assembled whole can still be faulty.
- The test can also be flawed: if the expected result was incorrectly specified, faulty code will still pass it.
- With a coding agent, ensure it fixes the code rather than weakening or deleting the test just to make the result green.
- Writing and maintaining tests takes time, and a high test coverage percentage alone does not indicate good quality.
Similar, but not the same
- integration test – Integration testing examines whether multiple units work well when connected, using a real database or network. Unit testing focuses on a single small unit, often isolated from its environment; the boundary is not always sharp in practice.
- end-to-end test – This is known as an end-to-end (E2E) test: it exercises the entire system from the user's perspective, for example a purchase from the cart to payment, so it is slower but more realistic.
- manual testing – In manual testing, a human clicks through the program, while a unit test runs automatically, without human involvement, as many times as needed.
Related concepts
software testing, automated testing, quality assurance
test coverage, teszteset, mock
integration test, test-driven development, regression test, continuous integration, coding agent
A brief history
Testing program parts separately dates back to the early decades of software development. Its modern, automated form was popularized by Kent Beck's SUnit framework for the Smalltalk language, and then by JUnit, co-authored with Erich Gamma in 1997.
Where things stand
By the end of 2026, unit testing is a standard practice in software development and runs automatically in almost every serious project. Coding agents write and run them in large numbers, so developers' attention increasingly focuses on whether the tests truly check the essentials.
In the news
Also known as
unit teszt · unit test · unit test · unit testing · unit testing · unit testing · modulteszt · komponensteszt
Sources
This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.