This discussion is archived
6 Replies Latest reply: Apr 3, 2013 9:48 PM by 982638 RSS

Code Coverage statistics in Unit Testing feature set seems incorrect

982638 Newbie
Currently Being Moderated
Hi,
I am trying to understand SQL Developer Unit Testing feature set. As code coverage is a feature provided in this tool, I am trying to understand the coverage statistics produced as a result of the same.

Given a procedure like this:

1     PROCEDURE award_bonus(emp_id NUMBER, sales_amt NUMBER) AS
2     commission REAL;
3     comm_missing EXCEPTION;
4     BEGIN
5     SELECT commission_pct into commission
6     FROM employees
7     WHERE employee_id = emp_id;     

9     IF commission IS NULL THEN
10     RAISE comm_missing;
11     ELSE
12     UPDATE employees
13 SET salary = salary + sales_amt * commission
14 WHERE employee_id= emp_id;
15     END IF;
16     END award_bonus;

I see a few issues in the way Total_Lines and Total_Occurences are being calculated:
for instance, in the above example
==> lines 2 and 3 above are not added to "Total_Occurences" but are added to "Total_Lines"
My understanding: Either they should not be added to "Total_Lines" or should be added to "Total_Occurences" to be correct.
==> lines 12 to 14 are counted as 3 and added to "Total_Lines". "Total_Occurences" is calculated as 1 which is right.
My understanding: Irrespecitve of the number of lines, each STATEMENT should be treated as 1. Hence, lines 12 to 14 should be counted as 1.

Please suggest if my understanding is correct. If yes, is there way to fix these issues.


Thanks & Regards,
Rahul


These are providing wrong results with respect to the coverage.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points