From the course: Refactoring with GitHub Copilot

Unlock this course with a free trial

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

Refactoring and automated testing

Refactoring and automated testing - Github Copilot Tutorial

From the course: Refactoring with GitHub Copilot

Refactoring and automated testing

You know that you and your team probably don't write enough tests, and that's okay. Most people don't. But Copilot can help. To be clear, this is about using AI to support traditional automated testing. The first step to adding tests is finding the right things to test. Not all functions or classes are in a testable state. Identifying the right place to start will help you continue to write tests once you get going. Asking Copilot to write tests for a function or method is a way to quickly see how complex the tests will be. This looks fairly straightforward. A tip though, usually the first test I write in every app is a test that true = true. This is so I can test that the test suite harness is correctly configured. From there, I can be confident that as I add tests and assertions, there will be value in running them. And this is that test. I need a composer install. Okay. Now I can use TestCase. And I will assertTrue is true. Now to run the tests, PHPUnit tests. And no surprise, it…

Contents