Timeline for Code coverage too low
Current License: CC BY-SA 3.0
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 13, 2014 at 23:22 | comment | added | Boris Bachovski | 100% agree, it's not just for the sake of getting 100% coverage, assertions are crucial to ensure the code is behaving properly. This answer was just purely to show what's missing, leaving the assertions on @user10843 :) | |
Aug 13, 2014 at 16:32 | comment | added | Chris Duncombe | I know this example is extremely basic, but I always try to never call a method in testing without some sort of assertion. You shouldn't test for code coverage, but for logical branch coverage. I would just add a few lines, where you set the variable, call the getter, and then assert the value is equal to what you set it to. I know in this example, it might be overkill, but it's a good habit to get into. Assertions, assertions, assertions.... :) | |
Aug 13, 2014 at 6:43 | history | answered | Boris Bachovski | CC BY-SA 3.0 |