๐๐๐๐ผ๐บ๐ฎ๐๐ถ๐ป๐ด ๐จ๐ป๐ถ๐ ๐ง๐ฒ๐๐๐ ๐ช๐ถ๐๐ต ๐๐๐ ๐
I had 30 validation functions. Writing tests manually was boring. I wanted a faster way.
I first tried a Python script. It failed on edge cases. I then tried regular expressions. It broke too often.
I switched to an LLM. I gave the model my function and a docstring. I asked for pytest functions. I used ast.parse to check the code. This caught syntax errors before the code reached my file.
It saved me 10 hours of work.
Use LLMs for boilerplate. Avoid them for these tasks:
- Complex database queries.
- Precise mocking of external services.
- Performance tests.
- Strict naming rules.
Three tips for you:
- Be specific in your prompt.
- Use a temperature between 0.2 and 0.4.
- Always validate the output.
How do you handle boring tests? Tell me in the comments.
Source: https://dev.to/__c1b9e06dc90a7e0a676b/i-spent-hours-writing-unit-tests-so-i-made-an-llm-do-it-and-learned-what-not-to-do-4d16 Optional learning community: https://t.me/GyaanSetuAi