From the course: Responsible GitHub Copilot: Creating Reliable Code Ethically

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Bulletproof your code: Unit and regression testing

Bulletproof your code: Unit and regression testing - Github Copilot Tutorial

From the course: Responsible GitHub Copilot: Creating Reliable Code Ethically

Bulletproof your code: Unit and regression testing

- Writing good tests is almost an art form. In my opinion, a test should be able to run in isolation from the rest of your environment. And test a single thing and nothing more. You create a test to codify your business rules on the objects and methods, or perhaps start a test from the outside as an integration test. In the past I have created SpecFlow like tests where we described in business language our expectations for an API and by only creating these types of tests, we had a high code coverage and we got high confidence that our API would still work according to our specs. In that case, there were no unit tests involved at all. So choose your set of tests very carefully. Just like trying to get a high percentage of code coverage by tests should not be a goal by itself. A test is there to increase your confidence as that code executes as defined, and now you can run those tests in different phases of your development cycle. A unit test often test only a single method of your code…

Contents