Laurie Williams, Ben Smith, Sarah Heckman, and Lauren Hayward [Contact Authors] |
| 1.0 | Introduction to Jazz Code Coverage |
| 2.0 | Running Jazz Code Coverage |
| 3.0 | Jazz Code Coverage Coverage Report |
| 4.0 | Exercise |
| 5.0 | Resources |
Jazz Code Coverage is a component that measures the test coverage as your projects evolve. Coverage is defined as a measure of the completeness of the set of test cases. This definition means that the more source code that is executed by your test cases the better. There are four types of coverage:
For small programs, coverage is relatively easy to calculate by hand; however, for larger programs, the task is much more difficult. Coverage tools, like Jazz Code Coverage, help by automating the coverage process and providing readable reports. Jazz Code Coverage may be used to calculate coverage for any launched application. We will be using it to calculate the coverage of our JUnit test cases (view the JUnit tutorial). You can run your JUnit test cases, and Jazz Code Coverage will generate the coverage report from the execution. Jazz Code Coverage provides overall, package, and file level information on statement coverage. Jazz Code Coverage can be downloaded as an incubator from jazz.net. For more information on installing eclipse plugins, consult the tutorial on the subject. |
Properties as shown in Figure 1.
|
There are two ways to obtain coverage results from a launched application: the label decorations in Java-based views such as the Package Explorer and the Outline view, or a customized coverage report based on an analysis over several Java projects and application launches.
|
For this exercise we will be using the CoffeeMaker project. Download the CoffeeMaker project from here or import the CoffeeMaker project that you used in the JUnit tutorial. For more information on CoffeeMaker, consult the CoffeeMaker User Stories and Black Box Test Cases. Unzip the CoffeeMaker project to your home directory and import the project into Eclipse. Please see the Rational XDE and Eclipse Import/Export Guide for instructions on how to import a project into Eclipse. We all know that most computer scientists love caffeine, so the Computer Science department is looking to put a coffee kiosk in the new building. The coffee kiosk must be able to make coffee for students to purchase. The CoffeeMaker code is complete; however, we need you to create and run unit tests until you have 90% coverage and a green bar on the CoffeeMaker, Inventory, and Recipe classes. Run your JUnit tests using Jazz Code Coverage and generate a coverage report. (Hint: Run Jazz Code Coverage on the initial project to see what coverage you already have, and what lines you need to test.) Deliverables to the TA
|