What are hallucinations and why can't you take an AI answer as is?
A hallucination is a confident but invented or unsupported model answer: the model picks tokens by probability and does not check truth. The most dangerous kind for QA is a rule added by analogy with typical systems, because it looks plausible. Asking again or asking if it is sure verifies nothing, so every expected result is traced to a requirement or a run, and the untraceable becomes a question to the PO.
QA Fundamentals · AI in testing
A case from AI says "under 100 UAH no fee". The requirement has no such rule. Where did it come from?
AI produced a table of test cases, and the QA is about to load it into the test management tool. One row expects a zero fee for transfers under 100 UAH. It seems logical, but the requirement has no such rule. The model did not lie on purpose, it added what is common in similar systems. This is a hallucination. The lesson covers why it happens, what kinds exist, how to notice it and why "just ask again" does not help.
How it works and why. The model picks tokens by probability and does not check truth. When the needed fact is neither in the context nor in training, the mechanism does not stop with "I don't know": it keeps writing the most plausible text. So a hallucination is not a malfunction but a side effect of how generative models work, and it can only be reduced. It helps to tell the kinds apart:
- Invented facts and objects: a non-existent API method or config option, a wrong quote or link, numbers without a source.
- Contradicting the supplied context: the requirement says one thing and the answer says another.
- Outdated: knowledge stopped at training time, and a new library version behaves differently.
- Added "by analogy": rules from typical systems that your system does not have. This is the most dangerous kind for QA because it looks plausible.
Two ways to treat an AI answer
Take it as is
The answer is smooth, so it is copied into a ticket or a test. A made-up method or rule ends up in code and documentation.
Check against the primary source
Each statement has a source: a requirement, documentation, a run. Without a source it stays a hypothesis.
Example: checking a case against the primary source. For each expected result we ask: where is this written? A made-up example:
Requirement PAY-142: fee 1%, minimum 5 UAH.
A case from AI:
TC-09: transfer 90 UAH
Expected: fee 0 (transfers under 100 UAH are free of fee)
Check:
"under 100 UAH, no fee" -> not in the requirement
by the requirement: 1% of 90 = 0.90, minimum 5 -> fee 5.00
Conclusion: the rule is made up. Fix the case; no question to the PO needed.
The method is simple: each expected value must be traced to a requirement, a schema or a run. What cannot be traced is either an invention (as here) or a gap in the requirements, and then it goes to the PO as a question. Another example from code: AI writes a test with a call like page.waitForNetworkIdleAndClick(). Playwright has no such method, and a run catches it immediately: the error appears at once. Code is cheap to check, while an invented rule stays silent until a late stage when someone notices a mismatch with the product.
Limits and alternatives. Access to documents (RAG) and search reduces made-up answers, because the answer relies on retrieved fragments, but does not remove them completely: the model can retell them inaccurately or fail to find the needed fragment. A request "are you sure?" checks nothing: the model can just as confidently confirm the wrong thing. Asking for a source is useful only when you actually open that source: links and quotes can be made up too. Lowering the temperature reduces the spread but does not make an answer true. Processes work more reliably: checking against primary sources, running code, a second source, risk assessment. The higher the cost of a mistake (money, security, compliance), the stricter the check. Automatic checking of answers against the context is applied when testing LLM features and is covered in the lessons about them.
Common mistakes.
- Trusting an answer because it is confident and well structured: style is not a measure of accuracy.
- Not running generated code and not opening the links it gives.
- Asking "are you sure?" instead of checking the source.
- Copying expected results into the test management tool without tracing them to requirements: an invented rule becomes the "reference" that the product is later fitted to.
- Forgetting that the model knows neither your product nor its defect history, and assuming complete coverage.
Check yourself
AI explained that Playwright has a method that automatically waits for the network and clicks. What should you do before using it in a test?
Answer
Check the official documentation to see whether such a method exists and what its syntax is, and run the code. If the method does not exist, the call fails at once. Until then the AI answer stays a hypothesis.
The model replied "yes, I checked everything against the documentation". Can you rely on that?
Answer
No. The model does not necessarily have access to the documentation at that moment, and the statement about checking is generated too. A human has to compare by opening the source, or a tool has to really return the retrieved fragments.