Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Missing statistics when intergrating Cobertura output to TFS run #1107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TobiasDo1 opened this issue Nov 2, 2020 · 6 comments · Fixed by #1137
Closed

Missing statistics when intergrating Cobertura output to TFS run #1107

TobiasDo1 opened this issue Nov 2, 2020 · 6 comments · Fixed by #1137

Comments

@TobiasDo1
Copy link

Describe the bug
Integration of Cobertura output xml to TFS pipeline run does show correct coverage results on summary, but not any detailed statistics, when navigating into coverage details page.
It does show selected packages from coverage run, but all values equal zero.

image

image

Provide version info
Information about utPLSQL and Database version,

set serveroutput on
declare
  l_version varchar2(255);
  l_compatibility varchar2(255);
begin
  dbms_utility.db_version( l_version, l_compatibility );
  dbms_output.put_line( l_version );
  dbms_output.put_line( l_compatibility );
end;
/
select substr(ut.version(),1,60) as ut_version from dual;
select * from v$version;
select * from nls_session_parameters;
select substr(dbms_utility.port_string,1,60) as port_string from dual;

DB_Version:
19.0.0.0.0
19.7.0

UT_Version:
v3.1.10.3349
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.7.0.0.0
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-Mon-RRRR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
IBMPC/WIN_NT64-9.1.0

Information about client software
XML generated via SQLPlus console with:

SET LINESIZE 1000
SET PAGESIZE 0
SET FEEDBACK OFF
SET serveroutput ON SIZE unlimited
SET TRIMSPOOL ON
CONNECT xx/yy@zz
spool test_sample.xml
EXEC ut.run(ut_coverage_cobertura_reporter(), a_include_objects=>ut_varchar2_list('PACKAGE1','PACKAGE12'));
spool OFF

To Reproduce
Steps to reproduce the behavior:
1.) Generate coverage xml file with ut_coverage_cobertura_reporter
2.) Integrate to TFS piepline with YAML like that:

- task: PublishCodeCoverageResults@1
  displayName: 'Publish Code Coverage results'
  inputs:
    codeCoverageTool: Cobertura
    summaryFileLocation: '$(build.sourcesDirectory)\test_sample.xml'

3.) Check summary and coverage details page

Expected behavior
Detailed information should be also available on the detailed coverage information page

Additional context
Uploaded test_sample.xml for reference (I had to rename it to txt to upload it here).

test_sample.txt

@TobiasDo1
Copy link
Author

I manually added the classes tag around every class entry and this helped to show some more details:
image

When navigating into specific package, there is no relationship to code lines. I assume that I will have to somehow link this here.
image

@pesse
Copy link
Member

pesse commented Nov 12, 2020

Thanks for reporting.
I assume it's a bug in the reporter.
I have planned to do some work on the reporters during the next couple of weeks and will look into it.
If you could investigate the raw files for the possible issues rather than the visual representation inside TFS, that would be helpful

@pesse pesse added the reporter label Nov 12, 2020
@drumbeg
Copy link

drumbeg commented Apr 28, 2021

Hi, any update on this issue? Hoping to integrate Cobertura results into our Azure DevOps pipeline.

@drumbeg
Copy link

drumbeg commented Apr 28, 2021

Thanks for reporting.
I assume it's a bug in the reporter.
I have planned to do some work on the reporters during the next couple of weeks and will look into it.
If you could investigate the raw files for the possible issues rather than the visual representation inside TFS, that would be helpful

The raw files also present this problem.

Although the overall line coverage is present for the suite, the figure is zero for each package section.

@lwasylow
Copy link
Member

Hi David
Would you be able to mockup a sample xml of the format expected or point to some format reference? Issue with reporters for each CI is usually finding a format to match with and I don't have an access to azure devops anymore.
Kind regards Łukasz

@OsBlaineOra
Copy link
Contributor

Same problem in GitLab

Broken XML Output

<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage line-rate="0" branch-rate="0.0" lines-covered="6" lines-valid="7" branches-covered="0" branches-valid="0" complexity="0" version="1" timestamp="1621528201.000000000000000000000000000002">
<sources>
<source>utplsql/betwnstr.fnc</source>
<source>utplsql/utils.pkb</source>
</sources>
<packages>
<package name="BETWNSTR" line-rate="0.0" branch-rate="0.0" complexity="0.0">
<class name="BETWNSTR" filename="utplsql/betwnstr.fnc" line-rate="0.0" branch-rate="0.0" complexity="0.0">
<lines>
<line number="6" hits="1" branch="false"/>
<line number="9" hits="1" branch="false"/>
<line number="10" hits="0" branch="false"/>
<line number="12" hits="1" branch="false"/>
</lines>
</class>
</package>
<package name="UTILS" line-rate="0.0" branch-rate="0.0" complexity="0.0">
<class name="UTILS" filename="utplsql/utils.pkb" line-rate="0.0" branch-rate="0.0" complexity="0.0">
<lines>
<line number="12" hits="1" branch="false"/>
<line number="16" hits="1" branch="false"/>
<line number="19" hits="1" branch="false"/>
</lines>
</class>
</package>
</packages>
</coverage>

Manually adding tags makes GitLab pickup the line coverage.

<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage line-rate="0" branch-rate="0.0" lines-covered="6" lines-valid="7" branches-covered="0" branches-valid="0" complexity="0" version="1" timestamp="1621528201.000000000000000000000000000002">
<sources>
<source>utplsql/betwnstr.fnc</source>
<source>utplsql/utils.pkb</source>
</sources>
<packages>
<package name="BETWNSTR" line-rate="0.0" branch-rate="0.0" complexity="0.0">
<classes>
<class name="BETWNSTR" filename="utplsql/betwnstr.fnc" line-rate="0.0" branch-rate="0.0" complexity="0.0">
<lines>
<line number="6" hits="1" branch="false"/>
<line number="9" hits="1" branch="false"/>
<line number="10" hits="0" branch="false"/>
<line number="12" hits="1" branch="false"/>
</lines>
</class>
</classes>
</package>
<package name="UTILS" line-rate="0.0" branch-rate="0.0" complexity="0.0">
<classes>
<class name="UTILS" filename="utplsql/utils.pkb" line-rate="0.0" branch-rate="0.0" complexity="0.0">
<lines>
<line number="12" hits="1" branch="false"/>
<line number="16" hits="1" branch="false"/>
<line number="19" hits="1" branch="false"/>
</lines>
</class>
</classes>
</package>
</packages>
</coverage>

This doesn't fix the "0.0" issue in the properties.

OsBlaineOra added a commit to OsBlaineOra/utPLSQL that referenced this issue May 20, 2021
utPLSQL#1107
The missing <classes> tags cause several CICD tools fail when displaying test coverage
@jgebal jgebal linked a pull request May 20, 2021 that will close this issue
OsBlaineOra added a commit to OsBlaineOra/utPLSQL that referenced this issue Jun 1, 2021
with covered lines / total  total lines.
Rounding to 17 decimal places since that's what I found when looking at cobertura examples online.
Used an rpad to generate the format mask to avoid having a long string of 9s.

This was mentioned in utPLSQL#1107 but does not have an issue of its own.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants