A3. Graph Coverage for Source Code

DUE: 11:59PM, Saturday 20 February 2016

30 points


Objectives

  • The goals for this assignment are to (1) use a source code coverage measurement tool, and (2) practice questions related to the material on graph coverage.

Tasks

  1. Q5 from Chapter 2, Section 2.2.1, page 43 of your textbook. You may find this website useful.

  2. Q7 from Chapter 2, Section 2.2.3 2.3, pp. 63-65 of your textbook.

  3. Using your code from A1, measure code coverage in the form of statement, branch, and method coverage using any Java code coverage analysis tool of your choice. Include the coverage numbers in your report.

    If your IDE doesn't already include such a tool, you can choose one from this webpage. For example, instructions for installing and using ECLEmma/JaCoCo as an Eclipse plugin are given below..

    How to install

    1. Go to Help -> Install New Software...
    2. Click on Add...
    3. Enter location: http://update.eclemma.org/ name : EclEmma Update Site and click ok.
    4. After clicking, it will take some time to EclEmma plugin appear in the text box.
    5. Click Select All and then Next.
    6. Click next, accept license agreement and client Finish. Ignore the security warning and restart eclipse.

    How to use

    1. Select the project for A1.
    2. At the top where you have the Play buttons for running programs, click on the down-arrow next to the play button that has a red and green rectangle on the bottom-left of the play button.
    3. You can run the project as JUnit or as Java Application.
    4. You should be able to view Coverage in the view Console. You can expand the package in the console and view coverage for individual files. If you run multiple times as you add test cases, you can view new coverage by selecting the sessions from a dropdown menu (the one with gears).
    5. You can also right click on the project for A1, and select Properties. Click on Coverage to see a summary of various types of coverage.
    6. The code view will show colors indicating which parts of the code are covered (or not).
      • green for fully covered lines
      • yellow for partly covered lines
      • red for lines that have not been executed at all
    7. Copy the coverage numbers and include it in your report.

Submission

Type the answers to the above questions in a document called a3.pdf. Submit the file using Assignment Submission in Canvas.


Grading criteria

  • Question 1: 10 points
  • Question 2: 15 points
  • Question 3: 5 points