Programming

Why GitHub checks your coverage report format

Passing tests and an accepted report are different checks. Use GitHub’s update to understand code coverage and the Cobertura XML format.

A programming lesson with a mentor at the academy
Illustrative photo: a practical lesson at the academy.

Check test success and report acceptance separately. On November 23, GitHub added format validation to Code Quality coverage uploads. An unsupported file now causes the upload step to fail.

Code coverage shows which program lines ran during a test. It does not establish that every answer is correct. Cobertura XML is a report format that stores coverage data in a defined structure.

For a small exercise, write a function that labels a number positive, zero or negative. Test a positive input first, then add zero and a negative input. Compare both the returned answers and the lines that ran.

Now configure your test tool to generate a Cobertura XML report and open the file to inspect it. Renaming a file does not convert its format. Uploads require Code Quality to be enabled; this update is unavailable on GitHub Enterprise Server.

Recommended reading

Networking

Why getting a DNS reply is not enough

Cloudflare checks DNS changes against what users receive. Learn to distinguish getting a reply from getting the expected updated value.

IT Innovations Editorial1 min read