Secure SDLC with AI: the AI that tests shouldn’t be the one that wrote the code
By Xavier Franco, CEO de Elternativa · Grupo Zemsania
· 6 min read
Written with the help of AI and reviewed by Xavier Franco

In this article
There is a rule that nobody questions in any serious company: whoever does something is not the one who signs it off. Accounting is audited by someone else. A large payment is signed by two people. And yet, with AI, we are accepting exactly the opposite: that the same tool that writes the code decides whether the code is right. That is why I insist on one rule, which I sum up like this: the AI that tests shouldn’t be the one that wrote the code.
What a secure SDLC is and why it matters again
The secure SDLC (secure software development life cycle, SSDLC) is the software development life cycle with security inside every step: in the requirement, in the design, in the code, in testing and in deployment. It is not a phase at the end, it is a way of working.
With AI writing a good part of the code, the secure SDLC is back at the center. Volume goes up a lot, and what used to be reviewed calmly now arrives at a pace no person can read line by line.
In practice: ask your team what share of the code integrated this month was written by an AI. If nobody knows, you already have your first task.
What the data says about AI-generated code
In July 2025 Veracode published a study worth keeping in mind. It analyzed 80 programming tasks with more than 100 language models, and the generated code introduced security vulnerabilities in 45% of cases. In Java, the failure rate exceeded 70%. And one finding that I think is the most important: the larger models did not do significantly better than the small ones.
In other words, waiting for the next model doesn’t fix the problem. Code written by an AI is, like anyone’s code, code that has to be checked.
The 2025 DORA report points the same way from another angle: 30% of professionals say they have little or no trust in AI-generated code. And it warns that, without solid control systems, such as strong automated tests, mature version control and fast feedback loops, a higher volume of changes leads to more instability.
Why the same AI can’t test itself
When you ask an AI to write code and, in the same conversation, to write its tests, something very human happens: the tests confirm what the code already does, not what it should do. If the model misunderstood the requirement, the tests inherit the misunderstanding and come out green.
That is why “the AI also writes the tests” is not enough. The check has to start from somewhere else:
- From criteria set before starting, not from the code already written.
- From another instance, one that hasn’t seen how the solution was reasoned.
- From a person, who decides whether what was delivered meets what was asked.
In practice: review a recent task done with AI. If the tests were written in the same session as the code, ask yourself what would have happened if the requirement had been misunderstood.
Separating who writes from who checks
This is how we set it up in our method, step by step:
- Requirement and plan. Every task is born with its contract and its acceptance criteria, set before starting. That contract is the reference for everything else.
- Development. An AI instance writes the code.
- Testing. A different instance from the one that wrote the code runs the tests, with a separate test queue. Whoever executes doesn’t validate their own work.
- Review and validation. A person validates the closure by looking at the code, and the signature is recorded.
- PR and deployment. The AI opens the pull request and respects your Git and your CI/CD, with their usual controls.
It is not distrust of AI. It is the same segregation of duties we apply to any process that matters.
Tests, in business language
A test that only its author understands is not a control either. That is why I like test cases to be written in business language, with “given, when, then” scenarios that anyone can read.
That way, whoever decides whether something is good doesn’t need to read the test code to know what has been checked. And each case is linked to the story and the decision that originated it, with its result recorded as evidence.
In practice: ask to be shown the test cases of a critical feature. If you can’t understand them without help, your business isn’t validating them.
What is learned stays as a rule
When a test finds a flaw, the easy thing is to fix it and move on. What is useful is that the flaw doesn’t happen again. In our method, every measured error is stored together with the defense that watches for it: an automated test, a check in the code or a constraint in the database. And it alerts only the roles and tasks it affects.
With AI this matters more than ever, because an instance doesn’t remember what happened in the previous task. If the lesson isn’t in the system, it is lost.
Where to start
- Measure what share of your code AI already writes.
- Set acceptance criteria before each task, not after.
- Separate who writes from who tests, even if both are AI.
- Have a person validate every closure, with a recorded signature.
- Turn every flaw into a rule that checks itself.
How we help
At Agentic Data & Software Engineering we orchestrate the development AI you already have across the whole SDLC: every task with its contract and criteria set before starting, tests run by a different instance from the one that wrote the code, and a person on your team who validates each closure by looking at the code. The code stays in your Git and respects your CI/CD.
We do it with Agentagile, our methodology for developing with AI: every delivery is tested and validated under the same rules, and nothing moves forward without your team’s approval.
Who tests what your AI generates today?
In a demo we show you how one instance writes, a different one tests, and a person on your team validates each closure by looking at the code.


