English subtitles

← Record and Replay Solution - Software Debugging

Get Embed Code
2 Languages

Showing Revision 3 created 05/24/2016 by Udacity Robot.

  1. Again this is fairly easy to realize,
  2. because we already have a template up here.
  3. So again, we have an index to the list of saved commands,
  4. which we call saved command index.
  5. So, at this moment we are in replay mode.
  6. While we are in replay mode the original input command function
  7. should no longer be called.
  8. All of the commands should now come from the saved commands in here.
  9. Let's see how this works.
  10. We get the same set of commands now being read
  11. from the saved commands variable.
  12. You read a program that is outside of the webpage
  13. one would now go and store the saved commands content
  14. permanently, say in a file for recording and for replaying.
  15. One would read this from a file.
  16. For programs that take text based commands,
  17. recording and replaying input is fairly easy to realize.
  18. However, as it comes to reproducing graphical user interaction
  19. it becomes hard to decide what of events to record and replay.
  20. Suppose you have a graphical user interface for a web browser.
  21. You have a captured replay tool that interposes itself
  22. between the user and the program and stores all events
  23. coming from the user in an event log such that they can be later replayed.
  24. The problem is: What is the abstraction level
  25. you're going to chose for your events?
  26. You could, for instance, go and record mouse clicks to gather with
  27. the coordinates of the mouse pointer.
  28. This is fairly easy to record.
  29. So, for instance, you could go and click here on search
  30. at the position, say 100x and 300y.
  31. Or, you could enter some text while the cursor is in the position 200 and 50.
  32. Click here on the file menu or here down on this roll-down menu.
  33. Of course, all of these then go into the event log.
  34. The problem is that for replaying, you need to have the exact
  35. same position of every element at the very same position on the screen.
  36. Now suppose your screen resolution changes. or the font size changes.
  37. Then some of the elements will still be more or less in their original positions,
  38. but others won't.
  39. We knew that the mouse click, which previously activated
  40. a particular button on the screen, will no longer work
  41. Likewise, if the position of some elements change,
  42. then as well, the recorded events will no longer work.
  43. Also, timing can become an issue.
  44. Suppose you recorded a click on this drop-down menu.
  45. Half a second later, when the drop-down menu appeared,
  46. you clicked on one of the elements in here.
  47. So far, so good.
  48. This is what you recorded.
  49. Now when you're replaying, and in particular,
  50. when you are replaying something from a web page,
  51. it may be that there are delays,
  52. and the drop-down menu will not appear on time.
  53. Then you'd be clicking somewhere completely different when replaying
  54. the recorded events, which stipulate
  55. that after half a second you'd click in this very position.
  56. Finally, of course, the program itself may change.
  57. If the search button is moved from down here to up here,
  58. then again replaying the event log based on absolute coordinates
  59. will click in the wrong position.