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.
Generate code from tests - Github Copilot Tutorial
From the course: Software Testing Assistance with GitHub Copilot AI
Generate code from tests
- [Instructor] In true test driven development, tests are written first. This of course, means the first time you run them they fail. Then you write the least amount of code necessary to make them pass and run tests again. While this can feel extreme, it can be an effective way to write a lot of code in a hurry. I'm going to pick up where I left off and add test logic for dealing with a trailing slash. So this assert true should redirect foo and foo with a trailing slash. This will of course fail when I run the tests because no logic has been implemented to deal with trailing slashes. And this time I'm going to call the test directly and as expected, failure. So the next step is to update should redirect. I'll add a comment about stripping the trailing slash and of course, co-pilot prompts the changes necessary. Now, this test was incomplete and I'm only testing should redirect, but it fails. And this failure points out a logic error I made. The error is that the array is fixed. I'm…