13
Coverage testing with CodePro Analytix So#ware Analysis and Tes1ng Cu Nguyen Duy (cunduy at :k dot eu) Alessandro Marche?o (marche?o at :k dot eu) Paolo Tonella (tonella at :k dot eu) Mariano Ceccato (ceccato at :k dot eu) Academic Year 20102011 Tuesday, November 9, 2010

Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Coverage testing with CodePro Analytix

So#ware  Analysis  and  Tes1ngCu  Nguyen  Duy  (cunduy  at  :k  dot  eu)

Alessandro  Marche?o  (marche?o  at  :k  dot  eu)

Paolo  Tonella  (tonella  at  :k  dot  eu)

Mariano  Ceccato  (ceccato  at  :k  dot  eu)

Academic  Year  2010-­‐2011

Tuesday, November 9, 2010

Page 2: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Introduction

Is a free, software testing tool for Eclipse Developed by Google Features:

Code analysis (audit, dependency, similarity) Junit test generation Code coverage Metrics for software quality

http://code.google.com/javadevtools/codepro

2

Tuesday, November 9, 2010

Page 3: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Installing CodePro Analytix Use Eclipse to Install New Software

Enter a correct version of Update Site with your Eclipse

http://code.google.com/javadevtools/download-codepro.html

3

Tuesday, November 9, 2010

Page 4: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Generate junit test classes (optional)

Select project, packages, or classes Right click > CodePro Tools > Generate Test

Classes

4

Tuesday, November 9, 2010

Page 5: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Enable coverageRight click on a project > CodePro Tools > Instrument for Code Coverage

5

Tuesday, November 9, 2010

Page 6: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Running for coverage

Run any kind of test cases (junit, FITTEST, etc.)

Run the application like normal use

6

Tuesday, November 9, 2010

Page 7: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Coverage analysis - 1

7

green: covered

red: not covered

Current coverage score

improvement since last run

coverage details

Tuesday, November 9, 2010

Page 8: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Coverage analysis - 2

8

Current coverage score

improvement since last run

History chart

Tuesday, November 9, 2010

Page 9: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Generate coverage report

9

Click on this button

Tuesday, November 9, 2010

Page 10: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Coverage report - 1

10

Tuesday, November 9, 2010

Page 11: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Coverage report - 2

11

Tuesday, November 9, 2010

Page 12: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Exercise 1

Open project: Exercise-3-MathOperators Enable Coverage on this project

Execute Unit TestGenerate coverage reportReport the test coverage of each class,

identify which lines of code have not executed

Task: improve the test cases to reach 100% coverage

12

Tuesday, November 9, 2010

Page 13: Coverage testing with CodePro Analytix · Exercise 1 Open project: Exercise-3-MathOperators Enable Coverage on this project Execute Unit Test Generate coverage report Report the test

Exercise 2

Similar to exercise 1, with Exercise-4-CurrentAccount

13

Tuesday, November 9, 2010