Analyzing Code Coverage
Select any tool that provides statement and decision code coverage. Utilizing the VendingMachine.java code given to you, develop a set of test cases for your code based on the following requirements:
- Takes in an integer input
- Allows users to select between three products: Candy (20 cents), Coke (25 cents),
Coffee (45 cents)
- Returns the selected product and any remaining change
- If there is not enough money to buy the product, displays the amount necessary to buy
the product and other products to purchase.
Execute the program with your test cases and observe the code coverage of your test cases. The goal is to reach 100% in both statement and decision coverage.
Please submit the following:
- Descriptionofthetoolusedandthetypesofcoverageitprovides
- Setoftestcases
- Screenshotshowingthecoverageachievedforthetestcasesdeveloped
- Your evaluation of the tool’s usefulness
Part 2:
Select any static source code analysis tool. The StaticAnalysis.java code given to you contains two different data flow anomalies. Execute the tool on StaticAnalysis.java and identify what the two data flow anomalies are. The inputs are:
- the weight of the package as an integer
- the length of the package as an integer
- the type of product as a String
Please submit the following:
1. Descriptionofthetoolusedandthetypesofanalysisitprovides
1
2. Descriptionofthetwodataflowanomalies 3. Screenshotshowingtheanalysisperformed 4. Yourevaluationofthetool’susefulness
Assessment
Your assignment will be scored based on the following criterion:
Part 1:
1. Descriptionofthetoolusedandthetypesofcoverageitprovides
2. Setoftestcases
3. Screenshotshowingthecoverageachievedforthetestcasesdeveloped 4. Evaluationofthetool’susefulness
Part 2:
1. Descriptionofthetoolusedandthetypesofanalysisitprovides 2. Descriptionofthetwodateflowanomalies
3. Screenshotshowingtheanalysisperformed
4. Evaluationofthetool’susefulness
This project is worth 80 points.
2





