Return to Video

03-29 Code Not Worth Covering

  • 0:00 - 0:03
    So case 1, the code that didn't cover is infeasible code.
  • 0:03 - 0:08
    The second case is the code that we believe to be feasible but which isn't worth covering.
  • 0:08 - 0:11
    A code might not be worth covering because it's very hard to trigger and it's very simple.
  • 0:11 - 0:16
    So let me give a quick example. The res variable is the result of the command to format a disc.
  • 0:16 - 0:18
    And if that operation fails, we'll just going to abort the program.
  • 0:18 - 0:22
    And so what might be the case is that we lack an appropriate fault injection tool
  • 0:22 - 0:25
    that will let us easily simulate the failure of a format disc call.
  • 0:25 - 0:29
    And in furthermore, the response of the code in this case is to
  • 0:29 - 0:31
    simply abort the execution of the program.
  • 0:31 - 0:35
    If those two things are the case, then we might be perfectly happy not to test this code branch,
  • 0:35 - 0:39
    and the reason is the abort code, which is going to terminate the entire application,
  • 0:39 - 0:42
    is presumably something that was tested elsewhere, so we don't have any real suspicion
  • 0:42 - 0:45
    that it might fail and there's no reason to think that calling it from a location like this
  • 0:45 -
    would act any differently or will probably be okay.
Title:
03-29 Code Not Worth Covering
Description:

03-29 Code Not Worth Covering

more » « less
Team:
Udacity
Project:
CS258: Software Testing
Duration:
0:48
Udacity Robot edited English subtitles for cs258 unit2 24 l Code Not Worth Covering
Amara Bot added a translation

English subtitles

Incomplete

Revisions Compare revisions