Skip to content

AI coding assistants: what they change in code review and testing

B2Bnetwork team · · 7 min

Technology and trends

In brief

AI coding assistants shift the weight of the work from writing code to checking it. A model quickly proposes a function, a test, or a change across many files, but responsibility for correctness, security, and architectural fit stays with a human. That is why three things gain importance: code review with a clear checklist, tests written from requirements rather than from the implementation, and automated CI gates that stop a change before it reaches production.

What an AI assistant actually does in a team

An AI assistant is a language model built into an editor, a terminal, or a code review system. It proposes code based on context: open files, a task description, an error message. The scope is wide:

  • suggests the next lines and whole functions as you type,
  • explains an unfamiliar piece of code, e.g. a legacy Java module or an SQL procedure,
  • generates unit test skeletons and test data,
  • prepares a change across many files from a task description,
  • comments on a pull request and points out places to improve.

Each of these produces a draft, not a finished result. The model does not know business requirements that are not in its context, does not know that in this bank amounts are stored in minor units as integers, and can confidently use a library function that does not exist. We describe the mechanism behind these errors in the article on hallucinations in language models.

Reviewing model-generated code

Code from an assistant is reviewed as rigorously as code from a new team member, and in a few places more carefully. The change is usually larger, written fluently, and looks well thought out, which lulls the reviewer into lowering their guard.

Checklist for the reviewer

  1. Does the change do what the task asked, and nothing more. The model happily refactors neighboring code or adds parameters nobody asked for "while it's at it."
  2. Do the APIs and libraries used exist in the version the project has. An invented method or an outdated signature is a typical error.
  3. Are the new dependencies necessary. Every new package is a supply chain risk; more in the article on SBOM and artifact signing.
  4. Security at system boundaries. SQL queries parameterized, input validated, secrets kept out of code, permissions checked on the server side.
  5. Error handling. The model likes to catch an exception and move on. In a payment system, such an empty `catch` means a lost transaction.
  6. Fit with the architecture and the repository style. The code should look like the rest of the project, not like an example from the documentation.

Smaller changes, more frequent review

A reviewer can realistically check a few hundred lines, not several thousand. That is why the rule "one change, one purpose" matters more with assistants than it did before. The pull request author describes which part the model generated and how they verified it: which tests they ran, what they compared by hand. This is not a formality but information for the reviewer about where to look.

An assistant can also be the first reviewer: it will point out typos, missing tests, or unused variables. It does not replace the human who knows the business context and is responsible for merging the change.

Testing in the age of generated code

The most important change in testing is where a test gets its expected result. If a model writes the code and then the tests for that same code, the tests confirm what the code does, not what it should do. Such a suite passes green even when the logic is wrong.

Practices that work:

  • Expectations from requirements. A person derives the test cases from requirements or acceptance criteria, and the assistant helps write them as code. For business rules, examples in the style of BDD work well.
  • Test first when fixing a bug. First a test that reproduces the bug and fails, then the fix, then the same test passes. Only then do you know the test checks anything at all.
  • Edge cases and denial paths. The model mostly generates the "happy path." The reviewer adds: an empty list, a boundary value, missing permissions, an exceeded timeout.
  • Mutation testing as a check on the tests. A tool deliberately breaks the code (e.g. replaces `>` with `>=`) and checks whether any test notices. If not, the tests are too shallow.
  • The structure of the suite stays the same. How easy it is to generate E2E tests tempts you to have hundreds of them. The proportions described in the test pyramid still apply, because E2E tests are slow and flaky regardless of who wrote them.

An assistant works well on tedious tasks: test data, mocks, rewriting an old test for a new framework, describing a case from existing code. There it saves time without shifting responsibility.

CI gates instead of trust

Since code is produced faster, the automated checks in the pipeline have to catch more. A minimal set for a team using AI assistants:

GateWhat it stops
Unit and integration testslogic errors, regressions
Static analysis and lintersdead code, unsafe patterns, style
SAST and SCAvulnerabilities in code and in dependencies
Secret scanningkeys and passwords pasted into the repository
Test coverage threshold (rising)changes without tests
Required human reviewmerging without a second pair of eyes

We describe how to choose scanners in the article on SAST, DAST, and SCA.

Team rules and company data

Before a team starts using an assistant, it is worth writing down a few rules. The most important one concerns data: what code and information may be sent to the model, whether the provider uses it for training, and where it is processed. At a bank or a telecom operator the answer is often: only a tool approved by security, no customer data in prompts, and no keys in the context. We write more about this in the article on company data and language models.

The second rule concerns accountability: the author of a change is responsible for all the code in the pull request, including the generated part. The third concerns learning: a junior developer who accepts suggestions without understanding them does not acquire the skills needed later for review. A good practice is to require that they can explain every line during review.

Since 2015, B2Bnetwork engineers have been testing the systems of banks, insurers, and operators and building test automation in CI. The scope of services is described in the What we do section.

Questions and answers

Should code from an AI assistant be labeled in a pull request?

There is no single binding rule, but it is worth doing. A short note on which parts the model generated and how the author verified them helps the reviewer focus on risky places. In regulated companies such a record is sometimes also part of the secure development policy and makes later audits easier.

Can an assistant write the tests for its own code?

It can help write them down, but the expected results should come from requirements, not from the code the model has just written. Otherwise the tests lock in faulty logic. A good safeguard is a test that fails first, plus mutation tests, which check whether the suite detects changes in the code at all.

Does AI code review replace the reviewer?

No. Automated review is good at catching small defects, missing tests, and known vulnerability patterns. But it does not know the business requirements, the history of decisions in the project, or the impact of a change on other systems. A human who is responsible for the change should approve the merge.

How do you check whether AI assistants are helping the team?

Measure what you measured before: time from task to deployment, the number of bugs found after release, the share of reverted changes, code review time. Compare the same metrics before and after introducing the assistant. The number of generated lines of code says nothing about quality or about how fast changes reach users.

What it looks like in a project

Considering a new technology for your system? Talk to an engineer.

Let's talk

Read more: Technology and trends