Generate Unit Tests Using AI Assistant

Can you make your life easier as a developer by using AI to generate unit tests?

View at original site


Author: Rachel Appel

In this blog post, Rachel discusses how AI can be used to generate unit tests and make the life of developers easier. She mentions that although AI can provide automation and make the development workflow smoother, it is important to carefully evaluate the results as they may sometimes be inaccurate. Rachel provides an example of a function that calculates the price of an item with tax and identifies the behaviors that should be tested.

She explains how to use the JetBrains AI Assistant in Rider to generate unit tests for the function. She also emphasizes the importance of not blindly accepting the results from AI and mentions that AI can also be used to generate tests first in a TDD approach. Rachel concludes by stating that using the AI Assistant in Rider is a great way to quickly generate meaningful tests that verify the code's functionality and meet the application's requirements.

Related Resources

Full Line Code Completion in JetBrains IDEs, All You Need to Know
What is full line code completion is, how does it work, what languages are supported, and how can you get started
Local and Fast AI comes to your developer workflow - Full Line Code Completion
Full line code completion is available for Java, Kotlin, Python, JavaScript, TypeScript, CSS, PHP, Go, and Ruby.
Stop using LLMs for these tasks!
Discover the ins and outs of large language models (LLMs) with Dr. Jodie Burchell.