News for hackers. Stuff that matters.
Re:Meta's new LLM-based test generator is a sneak peek to th... by makeitdouble on Saturday February 24, 2024 @04:58AM (#39490433)
Yes. There's also other (better) ways to solve this issue: for instance sampling input/outputs in production and srtting them in stone in the tests.

An issue with going with llms will be to validate if the behavior described are merely tolerated or if they're correct. Another will be wether something is actually tested (e.g. a code change still wouldn't break the test). Too granular output check would be an issue as well.

All in all this feels like a bad idea, but I hope to be wrong.

Re:Meta's new LLM-based test generator is a sneak peek to th... by wickedsickeune on Saturday February 24, 2024 @05:27AM (#39490553)
This is called a "golden master" (giving X input to the system and recording the output as a test expectation). The difference with the parent is that it is way less granular, so both have value.
Re:Meta's new LLM-based test generator is a sneak peek to th... by weebull on Saturday February 24, 2024 @07:23AM (#39490995)
This is something I've yet to see a software testing framework do. Compare the results of two different implementations separated in time. i.e. two different revisions out of source control, using one as the golden reference for the other.
Re:Meta's new LLM-based test generator is a sneak peek to th... by CHY872 on Saturday February 24, 2024 @08:31AM (#39491348)
bazhenov/tango does something like this for performance tests, basically to counter system behaviour you run the old and new implementation at the same time.
Re:Meta's new LLM-based test generator is a sneak peek to th... by adregan on Saturday February 24, 2024 @01:34PM (#39493944)
Isn’t that kind of what snapshot tests can do?
Re:Meta's new LLM-based test generator is a sneak peek to th... by fosstrack on Monday February 26, 2024 @01:21AM (#39508148)
I maintained a fairly successful legacy C/C++ application that performed business critical functions. The core developers were long gone, and countless of changes had to gone into it since. The only way the application survived was automatically comparing outputs and intermediate data structures against "ideal" values. Hundreds of business scenarios with their own input datasets. No one really understood what each scenario or ideal value meant. So your goal was to minimize divergence, and update the test case if it was deemed acceptable.
Re:Meta's new LLM-based test generator is a sneak peek to th... by hitchstory on Saturday February 24, 2024 @07:16AM (#39490967)
The problem is xUnit style tests are really bad at this and make it tedious - which is why people gravitate to LLMs for writing them. LLMs on the surface look like they can relieve the pain of using bad abstractions - but theyre still a band aid on a gaping wound. 20 years ago we'd be using them to write ugly raw PHP.

Characterization tests ideally need to not be written in code but defined in something resembling a configuration language - something without loops, conditionals, methods, etc. There then needs to be a strict separation of concerns kept between these definitions and code that executes them.

I wrote a testing framework (with the same name as my username) centered around this idea. Because it is YAML based, expected textual outputs can be automatically written into the test from actual inputs which saves tons of time and you can generate stakeholder documentation that validates behavior.

It might seem unbelievable but with decent abstractions, writing tests and TDD stops being a chore and actually starts being fun - something you won't want to delegate to an LLM.