From the course: Software Testing Assistance with GitHub Copilot AI
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Automated testing explained - Github Copilot Tutorial
From the course: Software Testing Assistance with GitHub Copilot AI
Automated testing explained
- [Instructor] Automated testing is the process of creating statements of fact about your code. This means that if you make a change that violates those facts, you'll know. I want to illustrate this idea very simply. I'm going to revisit the simple add function. This function expects two integers and returns an integer. To demonstrate this function, I'll just go to the end of this file and call add directly and I'll pass it five and two. And Copilot really wants me to add a comment that shows that it's seven. When I run this through the php interpreter, the output is seven. This is not revolutionary code, I realize. I'm going to compose and install a package called phpunit. More on that in future videos, but the important thing to know is that phpunit is a test framework, meaning it provides the functionality you need to test your code. Now that testing framework is installed, I'm going to write a test. Remember, we are testing a simple function, so our test is going to be simple as…