Has testing become more important with AI?

Has testing become more important with AI?

Reading or not reading code

Many recent discussions have appeared across social networks, with developers saying that reading code is no longer as important as it used to be, that AI now writes better code than a mid-level developer, and that the priority is now to launch user-facing features.

Many, however, agree that having tests in the code allows teams to move faster, because tests validate that the features being built match the requirements.

Tests will lead the way to agents

AI can still generate faulty code, and the problem can be even worse if it also writes the tests, because it may shape those tests to validate its own solution. As a developer, it’s important to stay in control of the code you are about to ship. That does not mean reading it like a novel, line by line, but understanding at a high level what it is trying to do.

As coding models continue to improve, implementation is becoming the most straightforward part of the job. What matters more now is each programmer’s judgement.

What matters now is asking: when this new piece of code launches, how many users per second or minute will it handle? Will it be available to everyone from day one? Could any security flaw affect the application?

Judgement and planning skills. Every day more important.

As I have done in some projects, I manually write the first three tests, and eventually the agent learns my programming style. Even so, it’s important to learn what a mock is, what a spy is, and so on. And, surprise surprise, to develop the judgement to know when to use them.

As your team grows, having pipelines that run code tests will allow even new developers to contribute from day one.

E2E + integration + unit testing

If I had to set a priority today, I would start with tests from the point of view of the final product or the user, and then progressively move down toward more technical tests.

Broadly speaking, this is how I currently see it:

Do I need my code to be tested as closely as possible to the customer experience? Use end-to-end (E2E) tests. A browser will execute your instructions to make sure the user experience is never interrupted.

Do I need to test my code at the API level? Use integration tests. Make sure users can’t send malicious payloads to your APIs. Check that the request content is what you expected and, if it isn’t, how the system should respond.

Do I need libraries, command-line tools (CLIs), or plugins I’m building to be used by other developers? Use unit tests. Although they are the most technical, they are great for making sure code used by other developers behaves as it should.

And the best of all?

The best part is that AI is getting better at writing tests. If you can give your agent instructions that ensure its tests make sense and follow the priority I explained above, you will have automated most of the work of writing tests. But remember one last time: judgement and reading.

You need to know how to read - and, with AI, when to read.

My posts are not AI generated, they might be only AI corrected. The first draft is always my creation

Tags

Author

Written by Helmer Davila

Related posts

AI is making technical work easier, but developer judgment and experience still matter.

AI Is Reducing Context Switching, But Experience Still Matters