# Writing Tests in Rust with Laguna

> Source: <https://www.dotnetperls.com/2026_7_23_writing-tests-rust-laguna>
> Published: 2026-07-23 07:00:00+00:00

**Tests** are important for ensuring **code quality**, and are even more important for programming in the age of **LLMs**. I have been using Laguna XS 2.1 with OpenCode to improve my test cases. Rust has native support for tests with "cargo test", so there are no excuses for skipping unit tests.

With AI agents, I have noticed they tend to create **unit tests** for functions they add. But sometimes these tests seem too **narrowly-focused**: they test a specific function, but we could use a more general test.

I had Laguna XS remove most of the tests in my Rust project, and added a new, **more general test** instead. The new test covers many functions at once. So I have fewer tests, but more **coverage** of the code, which seems to me a win.

I probably wouldn't have bothered doing this boring work if it were not for **agentic AI**. But overall, having the general tests is cleaner, less maintenance, and ensures higher quality—and I only had to do part of the work myself, as Laguna XS helped out.
