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
- Q5 from Chapter 2, Section 2.2.1, page 43 of your textbook. You may find this website useful.
- Q7 from Chapter 2, Section
2.2.3 2.3, pp. 63-65 of your textbook.
- 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
- Go to Help -> Install New Software...
- Click on Add...
- Enter location: http://update.eclemma.org/ name : EclEmma Update Site and click ok.
- After clicking, it will take some time to EclEmma plugin appear in the text box.
- Click Select All and then Next.
- Click next, accept license agreement and client Finish. Ignore the security warning and restart eclipse.
How to use
- Select the project for A1.
- 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.
- You can run the project as JUnit or as Java Application.
- 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).
- 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.
- 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
- 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