News for hackers. Stuff that matters.
Re:99% code coverage (2017) by jondubois on Wednesday January 16, 2019 @06:18AM (#18919878)
Unit tests should test individual subcomponents of your system in isolation. If your project is to build a car from scratch, then the unit cannot be the car. If your project is to build an autonomous fleet of self-driving cars, then from your project's perspective, the car could be a unit; the project to build the autonomous car would have different units from the project which manages the fleet of cars.
Re:99% code coverage (2017) by rypskar on Wednesday January 16, 2019 @07:36AM (#18920265)
Exactly, context matter. Most cases when some is writing for or against unit testing they miss the part about finding what they define as an unit. If the class need other classes to work, the whole set can be seen as one unit.

Who didn't want to test a private method before they see that a unit is more than a function?

Re:99% code coverage (2017) by Jach on Wednesday January 16, 2019 @10:17AM (#18921504)
I like to call it the 'system under test' / SUT. Then I can go on to say a unit test is a test that's fast and if it fails points to a specific problem in the SUT. Smaller SUTs obviously help satisfy both. If setting up collaborators in a bigger SUT leads to either unacceptable runtimes or too much brittleness from many things being able to go wrong, it's a signal you're not getting the value of unit testing in that place. (The test itself may or may not be valuable, other types of testing have their own value propositions.)
Re:99% code coverage (2017) by jbergens on Thursday January 17, 2019 @06:46AM (#18930047)
This means that the unit tests will miss a lot of possible errors. Nothing wrong with that, just use integration testing or functional tests to cover the other part.