Unit Test Generator (VakıfBank)
A VSIX extension I built for Visual Studio 2022+. It uses Roslyn to trim the selected service operation down and hands it to an LLM hosted inside the bank; it writes the test, runs it, and if it fails, rewrites it until it passes. 95%+ coverage with no developer intervention, in 45 seconds to 1 minute on average.
What Problem Does It Solve?
The hard part of retrofitting unit tests onto an existing service isn't the test itself; it's gathering the context the test needs. The public operation, the private methods it calls, its dependencies, entities, DTOs... Collecting all of that by hand is a tedious job you repeat for every method.
Unit Test Generator is a Visual Studio extension (VSIX) I built at VakıfBank to take over that job end to end. It runs on Visual Studio 2022 and later and talks to an LLM hosted inside the bank. Since the context grows once private methods, entities and DTOs are included, it uses the model with the largest context window available in the bank.
This extension's open-source sibling is VS2026 Unit Test Generator. Both share the same Roslyn approach; the difference is that the open version hands the context off to Copilot Chat, while the in-house version writes the test itself, runs it and fixes it until it passes.
How Does It Work?
1. Three selections
In the window that opens, you select, in order:
- The service file
- The public operation inside that service
- The test service file the test will be written to
The extension handles the rest.
2. Trimming the context with Roslyn
The extension doesn't send the code to the model as is. It uses Roslyn to keep only what's needed: comment lines are stripped and the context is narrowed. Everywhere the selected operation can reach is scanned: all private methods, entity methods and DTOs. The scan continues until it has enough scope to exceed the 90% coverage target.
3. Write, run, fix
The model writes the test, and the extension runs it immediately. If the test fails, the error output is fed back to the model and the test is rewritten until it passes. The loop is closed: no developer has to step in along the way.
Service + operation + test file selection
└─ Roslyn: trimmed context (private methods, entities, DTOs)
└─ In-house LLM: test generation
└─ Run the test
├─ success → done
└─ fail → regenerate with the error output
Results
95% coverage and above, even on very long, heavily branched methods; the average time per operation is 45 seconds to 1 minute. The developer only makes three selections and reviews the resulting test.
Muhammed Emin Özdemir
Senior full-stack developer at VakıfBank. Focused on enterprise systems, clean code and LLM-based tools.
More about me →
Comments
Be the first to comment