Return to Video

05-08 Testing Fault Injection

  • 0:00 - 0:04
    This is what we got this time--so we can see is that our fault injection version of read
  • 0:04 - 0:08
    is indeed reading less bytes than the full number of bytes we asked for
  • 0:08 - 0:12
    and what you can see is the first time it's called, you get the range from 1-3121,
  • 0:12 - 0:15
    so it's going to pick something in the middle usually, but then success of read calls have a narrow,
  • 0:15 - 0:19
    narrow range of random numbers that can return and so that's what explains this kind of
  • 0:19 - 0:22
    progressional numbers, that's what explains this sort of progression of numbers
  • 0:22 - 0:25
    towards smaller numbers, and so there should be a 100 of these little sequences
  • 0:25 - 0:29
    due to fact that we let the test loop 100 times.
  • 0:29 - 0:33
    So the question we can ask is, is our confidence in the software now are higher.
  • 0:33 - 0:36
    Well, probably there are other tests we should do--like one thing
  • 0:36 - 0:38
    we could do is use a read fault injection function.
  • 0:38 - 0:40
    Instead of being random just reads 1 byte every time--
  • 0:40 - 0:42
    that might end up being a reasonable stress test.
  • 0:42 - 0:45
    Another thing we might do is simulate random end of file conditions
  • 0:45 - 0:47
    when random errors that read is allowed to return.
  • 0:47 - 0:51
    So during our testing, the read system call never actually returned an error value.
  • 0:51 - 0:54
    It always read the file successful, but if we want to use fault injection to make it do that,
  • 0:54 - 0:57
    then we have to modify our program a little but, but I'm not going to do that right now.
  • 0:57 - 1:00
    In the meantime, I think we've established that the logic here is fairly solid.
  • 1:00 - 1:03
    It can do with a wide variety of conditions and one thing we might want to do just before
  • 1:03 - 1:07
    our leaving is out of the 1,000,000 times instead of 100 times.
  • 1:07 - 1:10
    Okay, so we compile with optimizations, we run it, it's running a 1,000,000 iterations
  • 1:10 - 1:14
    of the test sequence, so it's doing a 1,000,000 iterations of this little sequence here,
  • 1:14 - 1:17
    and let's see how long this takes, hopefully, it's not very long.
  • 1:17 - 1:19
    Okay, there we go--it took like 15 or 20 seconds, so that was a
  • 1:19 - 1:21
    little bit painful but not that bad overall.
  • 1:21 - 1:25
    And so the question is now do we have reasonable confidence that our logic is solid
  • 1:25 - 1:29
    and except for the error handling condition that we talked about, I would say that this is
  • 1:29 -
    probably pretty solid--this is probably pretty solid code now.
Tytuł:
05-08 Testing Fault Injection
Opis:

05-08 Testing Fault Injection

more » « less
Team:
Udacity
Projekt:
CS258: Software Testing
Duration:
01:32
Udacity Robot edited angielski subtitles for cs258 unit3 08 l Testing Fault Injection
Amara Bot added a translation

English subtitles

Incomplete

Revisions Compare revisions