r/PiCodingAgent • u/synwankza • Oct 19 '26
Question How do you test your features in AI coding era
Hey everyone,
Recently, I’ve been thinking a lot about how to properly test and verify the work done by AI coding agents, especially when working on existing, complex projects rather than simple greenfield applications.
I’m curious how you guys approach this in your workflows, particularly when changes need to be deployed to some preview/staging environment before you can actually verify whether everything works as expected.
And I’m not talking just about running unit/integration tests or having an agent write a few Playwright tests.
In real-world projects, verifying a change can involve a lot more than that.
For example:
- External APIs: Sometimes you need to retrieve a secret, authenticate against an external service, make some API calls, and verify the responses or side effects and it can’t be done from UI (because user has to do that manually and we have to simulate that)
- Observability: Sometimes the only way to confirm that something works correctly is to inspect Loki logs, traces, or metrics and check whether the expected events actually happened.
- Databases: You might need to query PostgreSQL or another database to verify that the correct records were created, updated, or deleted.
- Messaging: In event-driven architectures, you may need to verify that Kafka/RabbitMQ messages were published, consumed, and processed correctly.
- UI: And, of course, sometimes you need Playwright or another browser automation tool to verify user-facing functionality.
All of these might be part of a single business scenario.
For example, imagine an agent implementing a payment when user has to take some IBAN from our UI and proceed with manual bank transfer from their account, which results in a webhook to our API.
Then we have some soft validations which are testable only by checking some logs in our logs collector.
Do you:
- Let agents generate and execute E2E tests (e.g., Playwright) that also interact with APIs, databases, logs, and other systems?
- Give agents access to tools/MCPs for Kubernetes, Loki, databases, etc., and let them dynamically investigate and verify their changes - there’s an issue because as in my previous post Claude Code has some issues with working like that. Probably we would have to create a lot of some dynamic MCPs.
- Define deterministic verification scenarios/scripts that agents execute after deployment?
- Have a completely different approach?
I’m also curious about how you handle credentials, permissions, test data, and cleanup when agents need access to real infrastructure and external systems, even these secrets are only for sandbox.
And perhaps the biggest question: How do you make this repeatable and reliable instead of letting an LLM decide on the fly whether its own implementation is correct?
Would love to hear how you’re solving this in practice, what tools you’re using, and how much of your verification process is deterministic versus agent-driven.
4
u/typeof_goodidea Oct 19 '26
throwing together e2e tests is no longer a headache, so that's nice.
but I see this as more of a software architecture problem. not being able to easily test something is a smell. creating and maintaining an architecture that is testable takes consideration about how everything is coupled together - and LLMs busting out new features can quickly erode this.
2
u/Chubby-Princess Oct 19 '26
Railway is awesome for this. You can set up a staging environment or even automatic PR environments on your project. I also like Release Please because it allows you to merge things to main and only release production when you want to actually release to users. My setup is:
For separating environments, use an "environment=dev|staging|production" in your .env. This is useful beyond api calls and stuff, it can let you define a whole bunch if things like ui elements that only show in dev, disabling logins on dev, etc.
For databases I don't like using a real database in local dev, but I do like having one in staging that is separate from production. Railway makes this easy, and this flow also allows you to test migrations before they hit production.
I find agents are pretty good at writing tests and verifying their work today, so I don't really worry much about that stuff at the moment. Every feature gets manually tested by me, a real human (I promise) in local dev and in staging.
2
u/llufnam Oct 19 '26
It’s actually a really difficult problem because the point is you want to be directing but mostly out of the loop…but you can’t keep up with the code being generated and therefore can’t be in the loop enough to verify what’s happening.
1
u/gandazgul Oct 19 '26
A few things.
Make a QA runbook a document that the agent can read with all of these requirements you just listed. With links to where to get the credentials or to open a headed browser for you to login and then the agent can do the rest.
Use Vercel's agent-browser CLI is amazing and all the llms I've tried so far can use it with a simpler skill than the one they provide, theirs is a bit too much you can save tokens by making a smaller one with the basics and telling the agent to run --help for the rest.
Then make a canned prompt with the sequence for the agent to run specifically read the runbook, follow the instructions in there to run the test script. And tell it to update the runbook when it runs into issues or the runbook is outdated or you made a different decision review and commit the runbook on the repo.
1
u/nhi-yennnnn Oct 21 '26
Well, if you say you don't let agents access the tools - you might be outdated soon.
I think sooner or later everyone lets AI agents to access everything. The point is everything must be in control. Always give the agents the least privileges. And, always keep human in the loop.
1
u/tys203831 Oct 19 '26
Pstack - https://github.com/michael-denyer/pstack-claude/blob/main/plugins/pstack/skills/create-verification-skill/SKILL.md