From the course: Test-Driven Development in an AI World

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Generating tests with GitHub Copilot

Generating tests with GitHub Copilot

- [Instructor] Let's build a new feature, but this time you'll be using artificial intelligence to apply test-driven development principles. Keep in mind that AI is always changing, so you might not get the exact same results. Double check your code, and if things don't work out, you can always go back and try a different approach. Okay, let's get started. Open your terminal and "run npm run dev". Then open a second terminal and run the command "npm run test" to launch your test suite. Make sure all the tests pass before adding anything new. Take a look at the contact section of your app. We're going to add a new button to reset the form. But in this lesson, you will build this new feature using AI. Now go to the file "contact.test.jsx". It's already created for you. Go to the end of the code and open Copilot in-line chat by pressing "Ctrl + I" or "Command + I", depending on your operative system. From here, you can send prompts and insert code directly into your files. Ask, "generate…

Contents