Return to Video

03-20 Other Metrics

  • 0:00 - 0:03
    We looked a couple common coverage metrics that come up in practice.
  • 0:03 - 0:06
    So, we've looked at statement coverage, which is close relative to line coverage.
  • 0:06 - 0:09
    We looked at branch coverage, also called decision coverage,
  • 0:09 - 0:14
    and for most of you out there, these are the coverage metrics that are going to matter for everyday life.
  • 0:14 - 0:17
    Now, as I said before, there are many other coverage metrics,
  • 0:17 - 0:19
    and we're going to just look at a few of them.
  • 0:19 - 0:21
    The reason these are interesting is not because we're going to go out and obsessively
  • 0:21 - 0:24
    get 100% coverage on our code on all these metrics.
  • 0:24 - 0:27
    But rather because they form part of the answer to the question
  • 0:27 - 0:31
    how shall we come up with good test inputs in order to effectively find bugs in our software?
  • 0:31 - 0:33
    Loop coverage is very easy.
  • 0:33 - 0:38
    It simply specifies that we execute each loop 0 times, once, and more than once.
  • 0:38 - 0:41
    The insight here is that loop boundary conditions are an extremely frequent source
  • 0:41 - 0:43
    of bugs in real codes.
  • 0:43 - 0:46
    For example, if we had this loop in our Python code,
  • 0:46 - 0:50
    so for a line in open file--that is to say we want to read every line from the file
  • 0:50 - 0:54
    and then process it--to get full loop coverage we would need to test this code
  • 0:54 - 0:59
    using a file that contains no lines, using a file that contains just one line,
  • 0:59 - 1:01
    and using a file that contains multiple lines.
  • 1:01 - 1:06
    Now, let's look at a fairly heavy-weight coverage metric called modified condition decision coverage or MC/DC.
  • 1:06 - 1:10
    If that seems like kind of a big mouthful, there's a reason for that,
  • 1:10 - 1:15
    which is that MC/DC coverage is required for certain kinds of avionics software.
  • 1:15 - 1:19
    That is, if you're going to write safety critical software, where if the software fails,
  • 1:19 - 1:22
    airplanes can fall out of the sky, then one of the things you'll need to do to show
  • 1:22 - 1:26
    that you're software is correct is get a high-degree of MD/DC coverage.
  • 1:26 - 1:31
    It's designed to be pretty rigorous but still without blowing up into an exponential number of tests.
  • 1:31 - 1:35
    MC/DC coverage basically starts off with a branch coverage,
  • 1:35 - 1:39
    so I'm going to simplify here a little bit, but MC/DC coverage basically starts off with branch coverage.
  • 1:39 - 1:44
    It additionally states that every condition involved in a decision takes on every possible outcome.
  • 1:44 - 1:48
    Conditions are simply boolean-valued variables found in tests,
  • 1:48 - 1:52
    and decisions are just the kind of tests that we see in an if statement or a while loop,
  • 1:52 - 1:54
    or something like that.
  • 1:54 - 1:57
    Finally, every condition used in a decision independently affects its outcome.
  • 1:57 - 1:59
    So, that's kind of a mouthful.
  • 1:59 -
    This is going to be hard to grasp unless we go through an example, so let's do that.
Cím:
03-20 Other Metrics
Team:
Udacity
Projekt:
CS258: Software Testing
Duration:
02:02
Udacity Robot edited Angol subtitles for cs258 unit2 16 l Other Metrics
Amara Bot hozzáadott egy fordítást

English subtitles

Incomplete

Felülvizsgálatok Compare revisions