A10: Graph Coverage
DUE:
11:59PM, Monday 4 December 2017
40 points
1. Goals
The goals of this assignment are to (1) use a source code coverage measurement tool, and (2) practice questions related to the material on graph coverage.
2. Tasks
Answer the following questions.
- (15 points) Question 5 on page 122 of the Ammann and Offutt textbook.
- (20 points) Consider the main method provided in the PrimeSieve class on the website linked here. Answer the following questions:
- Draw the control flow graph for the statements inside the main method.
- Enumerate the test requirements for node coverage, edge coverage, and prime path coverage for the above graph.
- List test paths that achieve node coverage but not edge coverage on the graph.
- List test paths that achieve edge coverage but not prime path coverage on the graph.
- Create tables as shown in slide #48 to show the def-use pairs for each node and edge.
- Create a table as shown in slide #50 to show all the DU pairs for each variable
- (5 points) Using your own code from the implementation of assignment A9, 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. Your goal is to measure coverage of the code inside ChatbotServer.
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 A9.
- 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.
3. Submission
- Submit your answers in one PDF file called a10.pdf.
- Put your name at the top of the each page.
- Important Reminder: You may use material from the book or other sources in your answers. However, you must cite your sources properly. Any verbatim quotations must be enclosed in quotation marks, with page numbers indicated. You will receive severe point deductions if you use material from the text or other sources that is not properly cited.