From the course: Agile Software Development: Clean Coding Practices
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Keep your tests fast
From the course: Agile Software Development: Clean Coding Practices
Keep your tests fast
- [Instructor] It is important that unit tests are fast. Ideally, each test should complete in less than one second. When your unit test suite is slow, it becomes annoying to run it. And if you stop running your test as part of your development process, then they are not providing you any help. Communicating with an external service is the most common reason that a test is slow. Examples of external services are databases with APIs and hardware devices. Here is a test suit for a simple GitHub API client. It check to make sure that the client retrieves the correct information for the GitHub repository used by Microsoft's typescript project. Let's run the test suite to see the results. We're using the time command to help us tell exactly how long it takes the test suite to run. There are two things to notice. First, we had some tests fail, and the reason that they failed is because the values that are being checked have…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.