Session 3. Instrumentation

In Session 1, LiveCoverage launched the sample application. By adding instrumentation to the application, you can still measure test coverage when the application is launched manually.

  1. If the project created in Session 1 is not open, open it with File | Open Project.

  2. Select Test | Properties... to open the property pages.

  3. On the tab labeled Executables, check the box labeled Instrument. This will cause LiveCoverage to add a tiny snippet of code to the sample application so that it will notify LiveCoverage when it is running.

  4. On the tab labeled Project, delete the entire contents of the text box labeled Command Line. This will prevent LiveCoverage from launching the sample application itself.

  5. Also on the Project tab, check the box labeled Listen for Instrumented Executables. This will cause LiveCoverage to watch for the signal sent by the instrumentation added to the application.

  6. Click OK on the Properties dialog to accept to the changes.

  7. Select Test | Clear Coverage to clear all previous test coverage results.

  8. Select Test | Start. This time, the sample application does NOT launch. But the right half of the status bar will say "Monitoring test coverage". LiveCoverage quietly adds the instrumentation code to the sample application.

  9. Go to the taskbar and select Start | Run. Type in the full pathname of the sample application (normally C:\Program Files\LiveCoverage\DemoFiles\Scribble.exe) or use the Browse button to open a dialog box and navigate to it. Click OK to run the sample application.

  10. LiveCoverage will now show some code has been executed, just as it did in Session 1.

  11. Close the sample application. LiveCoverage continues to monitor for test coverage.

  12. On the taskbar, select Start | Run again. The pathname to the sample application should appear by default. Click OK to run it again.

  13. Keeping an eye on the summary window, click and drag the mouse in the sample application window, drawing a line freehand. You can also use some of the sample's menus. Notice how the Hit count and Percent both jump.

  14. Close the sample application again.

  15. Select Test | End to terminate test coverage monitoring. LiveCoverage removes the instrumentation code from the sample application.

  16. Close LiveCoverage or Select File | New Project, but do NOT save the changes to the current project.