Java代写:CSE565 Analyzing Code Coverage

任意选择一款包含覆盖率测试的测试工具,对提供的文件编写测试用例进行测试,满足Code coverage要求。

Testing

Part 1

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 statement and 90% in decision coverage.

Please submit the following:

  1. Description of the tool used and the types of coverage it provides
  2. Set of test cases
  3. Screenshot showing the coverage achieved for the test cases developed
  4. 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. Description of the tool used and the types of analysis it provides
  2. Description of the two data flow anomalies
  3. Screenshot showing the analysis performed
  4. Your evaluation of the tool’s usefulness

Assessment

Your assignment will be scored based on the following criterion:

Part 1

  1. Description of the tool used and the types of coverage it provides
  2. Set of test cases
  3. Screenshot showing the coverage achieved for the test cases developed
  4. Evaluation of the tool’s usefulness

Part 2

  1. Description of the tool used and the types of analysis it provides
  2. Description of the two date flow anomalies
  3. Screenshot showing the analysis performed
  4. Evaluation of the tool’s usefulness