utPLSQL icon indicating copy to clipboard operation
utPLSQL copied to clipboard

Code Coverage does not exclude Tests

Open wolframhaussig opened this issue 2 years ago • 4 comments

Describe the bug I have a problem which might relate to #393. I use SqlDeveloper and the utPLSQL plugin to create code coverage and get the Packages containing the tests in the coverage report.

Provide version info Information about utPLSQL and Database version,

19.0.0.0.0
19.0.0

PL/SQL-Prozedur erfolgreich abgeschlossen.

UT_VERSION                                                  
------------------------------------------------------------
v3.1.12.3589


BANNER                                                                           BANNER_FULL                                                                                                                                                      BANNER_LEGACY                                                                        CON_ID
-------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ----------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production           Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production                                                                                           Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production                    0
                                                                                 Version 19.15.0.0.0                                                                                                                                                                                                                                         



PARAMETER                      VALUE                                                           
------------------------------ ----------------------------------------------------------------
NLS_LANGUAGE                   GERMAN                                                          
NLS_TERRITORY                  GERMANY                                                         
NLS_CURRENCY                   €                                                               
NLS_ISO_CURRENCY               GERMANY                                                         
NLS_NUMERIC_CHARACTERS         ,.                                                              
NLS_CALENDAR                   GREGORIAN                                                       
NLS_DATE_FORMAT                DD.MM.RR HH24:MI:SS                                             
NLS_DATE_LANGUAGE              GERMAN                                                          
NLS_SORT                       BINARY                                                          
NLS_TIME_FORMAT                HH24:MI:SSXFF                                                   
NLS_TIMESTAMP_FORMAT           DD.MM.RR HH24:MI:SSXFF                                          

PARAMETER                      VALUE                                                           
------------------------------ ----------------------------------------------------------------
NLS_TIME_TZ_FORMAT             HH24:MI:SSXFF TZR                                               
NLS_TIMESTAMP_TZ_FORMAT        DD.MM.RR HH24:MI:SSXFF TZR                                      
NLS_DUAL_CURRENCY              €                                                               
NLS_COMP                       BINARY                                                          
NLS_LENGTH_SEMANTICS           CHAR                                                            
NLS_NCHAR_CONV_EXCP            FALSE                                                           

17 Zeilen ausgewählt. 


PORT_STRING                                                 
------------------------------------------------------------
x86_64/Linux 2.4.xx

Information about client software I use the SQLDeveloper with utPLSQL plugin in version 1.4.0

To Reproduce My unittest packages all look similar to this:

create or replace PACKAGE test_pkg IS

   /* generated by utPLSQL for SQL Developer on 2020-03-10 08:57:25 */

   --%suite(test_suite)
   --%suitepath(com.my.company.app)

   --%test(test method)
   PROCEDURE test_method;

END test_pkg;

Expected behavior All UnitTest packages should be excluded

wolframhaussig avatar Aug 02 '22 12:08 wolframhaussig

Hello @wolframhaussig

I'm afraid I cannot fully understand and reproduce your problem. Can you say in simple words what is it that you expect / don't expect to get in coverage report vs. what you actually get/don't get?

jgebal avatar Aug 02 '22 21:08 jgebal

An example with some dummy packages would be really helpful

jgebal avatar Aug 02 '22 21:08 jgebal

I am sorry if my description was confusing. Here is a simple example:

create or replace PACKAGE pkg IS
    FUNCTION hello RETURN VARCHAR2;
END pkg;
/
create or replace PACKAGE BODY pkg IS
    FUNCTION hello RETURN VARCHAR2 AS
    BEGIN
        RETURN 'Hello World!';
    END hello;
END pkg;
/
create or replace PACKAGE test_pkg IS

   /* generated by utPLSQL for SQL Developer on 2020-03-10 08:57:25 */

   --%suite(test_suite)
   --%suitepath(com.my.company.app)

   --%test(test method)
   PROCEDURE test_method;

END test_pkg;
/
create or replace PACKAGE BODY test_pkg IS

   /* generated by utPLSQL for SQL Developer on 2020-03-10 08:57:25 */

   --%suite(test_suite)
   --%suitepath(com.my.company.app)

   --%test(test method)
   PROCEDURE test_method AS
   BEGIN
    ut.expect(pkg.hello).to_equal('Hello World!');
   END;

END test_pkg;

This is just a simple hello world package with a unit test. There is just one test which is successful: image

When running the code coverage I would expect the pkg package to be listed but not the test_pkg as this is just the unittest. But in reality I see both: image

Am I doing something wrong?

wolframhaussig avatar Aug 03 '22 04:08 wolframhaussig

Hi @wolframhaussig Thank you for providing details of this issue. It looks like a regression error introduced in version 3.1.11 with removal of this line of code I checked a bit deeper and it seems like a line responsible for that functionality was disabled by me for some reason while implementing the feature.

I'll investigate a bit further and see if it can be easily fixed by enabling this line. Definitely we miss a test to cover that functionality.

jgebal avatar Aug 15 '22 18:08 jgebal

@jgebal Sorry to resurrect this: Is there a release planned in the near future? I do not want to deploy a snapshot version on all of our databases so I would be glad if this would be released sometime.

wolframhaussig avatar Dec 07 '22 05:12 wolframhaussig

Hi @wolframhaussig I'm in the process of moving houses now so it's quite difficult to promise a date. I will aim to do the release over the weekend.

jgebal avatar Dec 07 '22 12:12 jgebal