Skip to content

Hack Week experiment: unit tests with claude#2922

Draft
ancorgs wants to merge 18 commits intoapi-v2from
hack-week-claude-attempt1
Draft

Hack Week experiment: unit tests with claude#2922
ancorgs wants to merge 18 commits intoapi-v2from
hack-week-claude-attempt1

Conversation

@ancorgs
Copy link
Copy Markdown
Contributor

@ancorgs ancorgs commented Dec 1, 2025

DISCLAIMER: This is not intended for production. Claude.ai has not been audited by neither SUSE or the openSUSE project, so I have no intention to introduce any code generated by such a tool into any production-ready branch of the Agama repository.

Problem

Adapting the unit tests manually when we refactor the code takes a lot of time.

Experiment

During this Hack Week we want to explore how AI can speed-up the process. See https://hackweek.opensuse.org/projects/ai-powered-unit-test-automation-for-agama

This is a first rough experiment using the free version of Claude.ai. It includes the rationale applied by the tool as markdown files. It is written in Spanish because I used the web console (the only interaction method available for free) and my browser is configured to request pages in Spanish.

What I did was:

Asking Claude to adapt the current unit tests to the changes introduced in the code.

It did a great job. I tried it with 5 different test files and 3 of them worked out of the box. 2 of them needed trivial fixes (committed separately). The changes introduced make sense to me at first sight (I still have to review them carefully). It was not too intrusive, it respected the approach of the original tests. Although it decided to expand some parts.

Asking Claude to write a difficult test (LvmPage) from scratch.

At first sight, the test seems to be correct and very comprehensive (it even allowed me to fix a bug in the code). Claude shows very good understanding on what the component is supposed to do.

Initially the data of the mocks contained errors because Claude does not have full access to the api-v2 repo branch. But as soon as I gave it the correct type definitions it was able to fix those errors itself and produce a fully working test (except one minor fix that is 100% understandable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant