Remix.run Logo
madeofpalk 10 hours ago

Tests! Unit tests, integration tests, random adhoc scripts. You know - TDD!

I’ve been working on UI component improvements and it was doing a lousy job until i specifically told it to test in a headless browser to validate it works. I think somewhere in an AGENTS.md i have an instruction to “don’t state your guesses as fact - validate findings and results”.

Tade0 10 hours ago | parent | next [-]

It bothers me that you have to explicitly state this to the agent. Makes me think what else is missing from that file which also needs to be explicitly stated, but I don't know what don't know. "Do a good job"?

Gareth321 8 hours ago | parent | next [-]

This is where the harness shines. It's why products like Cursor have been growing like crazy. If you drop an extremely intelligent person into a problem they've never seen before, the initial context and knowledge-sharing just to get them up to speed is immense. They'll make a lot of mistakes until they're ready to fix your problem. The harness can leapfrog most of that. There is a booming industry in harnesses with no saturation in sight. We're not even close to maximising the utility of current models, let alone the amazing improvements which are happening week to week.

QuercusMax 5 hours ago | parent [-]

How does the cursor harness help here compared to something more basic like pi coder? I'm talking specifics.

derefr 4 hours ago | parent | prev | next [-]

An agent doesn’t know what “job” it’s being asked to do until you tell it.

Imagine you’re blind and deaf and have temporary retrograde amnesia. You “wake up” one moment with a memory of some words in your head like “what is the bug?” …but you don’t recall the context of that question, and nor can you look/listen around to observe the context.

So you don’t know whether you’re e.g. at the office, in front of your computer, in the middle of doing some pair-programming (where, yes, you’d in investigate the bug thoroughly with tools), vs. having a conversation with a colleague over lunch (where the expectation is for you to tap into your knowledge + intuitions to either guess or say you don’t know — not to pull out your laptop.

That’s what it’s like to be one of these LLMs being prompted by some agent harness. Unless the harness injects the proper context into its “recent memory”, it just doesn’t know.

Leynos 4 hours ago | parent | prev | next [-]

If you ask Fable or 5.6 Sol to improve performance, it will generally know to build a benchmark and create a test corpus. I'm not sure where the contrary suggestion is coming from.

swat535 4 hours ago | parent | prev | next [-]

Additionally, if you are asking agents to write test, be very careful. They will write tautology tests.

They will mock things to no end. They will flat out REMOVE assertions (saying it's not needed). They can also write test to assert the wrong result.

You have to always review it, it's exhausting.

Tade0 4 hours ago | parent | next [-]

That is my experience as well. I write tests by hand because they really still can't do it properly.

And I think I know why - neither do most people.

QuercusMax 4 hours ago | parent | prev [-]

This was my experience with some of the stupider models, but I haven't had Claude do this type of thing since I started using it for work about 6mo ago.

Claude will do some boneheaded things for sure, but it's pretty good about writing tests that are useful, and not removing or modifying tests just because they're in the way.

Claude is pretty bad about assuming that it couldn't have broken a test it didn't know about, as it has often told me "this is already broken on main" which is definitely NOT true.

Filligree 9 hours ago | parent | prev [-]

Will, it depends on the AI. Anthropic used to have a lecture-length system prompt for their models to explain this stuff—part of the secret sauce for Claude Code—and famously found that the 5 series models no longer need it.

As usual, if you use anything but the best model available I’m going to state that the better ones do better. If you do use the best model available, then I’ll just mention that Fable still has limits and still needs some guidance.

One thing it does not do is deliberately build tests which test nothing at all, or which restate the code under test. I mention this because certain other models absolutely would.

tester756 7 hours ago | parent | prev | next [-]

>Tests! Unit tests, integration tests, random adhoc scripts. You know - TDD!

Tests =/= TDD

troupo 7 hours ago | parent | prev | next [-]

> Tests! Unit tests, integration tests, random adhoc scripts. You know - TDD!

Tests onli validate the presence of bugs, not their abscence (Djikstra).

I'll also add that tests look at outputs and don't care how those outputs are derived. E.g. code filtering the entire db in memory will be fine in tests.

bluGill 6 hours ago | parent | next [-]

"Beware of bugs in the above code; I have only proved it correct, not tried it." - Donald Knuth

Tests prove the things you thought of worked, and it often isn't hard to find the likely edge cases such that you have reasonable confidence everything works. You will be wrong from time to time, but not that often. You can prove code correct, but if the proof is wrong (common when a human is doing it), or the spec is wrong (most people have no clue how to write a comprehensive spec) it can still be wrong.

anthonyrstevens 5 hours ago | parent | prev [-]

Haven't you ever written tests that assert that certain things happen or do not happen along the way? We use mocks all the time to, say, make sure that the code doesn't load the entire db in memory. Then it's there as a regression if somebody down the line wants to do that exact thing for some reason.

troupo 4 hours ago | parent [-]

Unfortunately, with LLMs you have to write these tests for every little thing.

And then there's the endless code duplication, reinventing of existing code and libraries etc.

altmanaltman 9 hours ago | parent | prev | next [-]

If the agent can write the tests its supposed to pass and we are worried that agent produces quite a lot of slop (which is why we are doing the tests), then what is the defense against test slop? Test the tests?

user43928 9 hours ago | parent | next [-]

Manual testing.

I work on user facing applications, and since the models do not have good taste, testing the UX is essential.

If you spot a bug, usually the model will attempt to reproduce it in a new test case that does cover the actual issue.

Leynos 4 hours ago | parent | prev | next [-]

1st line of defence, use something like ponytail to enforce brevity. Use property testing and behavioural testing on top of unit testing. Enforce readability standards so you will be able to understand the tests.

2nd line, code review.

Do the first pass with an agent, ask it to bounce back vacuous or tautological tests. Ask it to verify that the tests verify what they claim to. Then read them yourself.

3rd line, mutation testing. If the tests don't actually catch broken code, kill the mutants.

Filligree 9 hours ago | parent | prev | next [-]

Read the tests.

Doing a pass where you just ask the AI to sanity-check the existing tests (against rules like “test against the spec, not the implementation” can also help.

KptMarchewa 9 hours ago | parent | prev | next [-]

Existing tests.

mikeydiamonds a minute ago | parent | prev [-]

[dead]

KptMarchewa 9 hours ago | parent | prev [-]

In this particular case tests won't help you, without the actual data. But overall you're right.

madeofpalk 9 hours ago | parent [-]

"tests" here could mean have a benchmark the agent can run to determinately evaluate quality.

I don't strictly mean junit unit tests.