AI for PHP, How to Make AI Assistant Generate Test Implementations

What if we want to take a more test-driven-development approach, writing our tests first, and having AI Assistant generate an implementation for us?

View at original site


Author: Brent Roose

This article explores how to use JetBrains AI Assistant to generate code implementations based on written tests. Instead of starting with an implementation and generating tests, this approach follows a test-driven development (TDD) approach where tests are written first.

The article demonstrates how to use AI Assistant to generate an implementation by opening the AI Actions menu, selecting "New Chat Using Selection," and providing a prompt to write an implementation for a test. AI Assistant quickly generates the implementation, which can be copied into a file and tested.

The article also explains how to save and reuse custom prompts for future use. The author acknowledges that AI Assistant may not write perfect code, but it is useful for generating boilerplate code and saving time. While AI may not replace real programmers, it is a helpful tool for accelerating the coding process.

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.