Skip to content
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

Add test coverage report #864

Closed
nima-karimi opened this issue Jul 7, 2021 · 3 comments · Fixed by #2238
Closed

Add test coverage report #864

nima-karimi opened this issue Jul 7, 2021 · 3 comments · Fixed by #2238
Labels
type: technical debt This issue/PR represents/solves the technical debt of the project.

Comments

@nima-karimi
Copy link
Contributor

Add a test coverage report for unit tests and include a check for Travis.

Some useful links:

@nima-karimi nima-karimi added the type: technical debt This issue/PR represents/solves the technical debt of the project. label Jul 7, 2021
@nima-karimi nima-karimi self-assigned this Jul 7, 2021
@tomalec
Copy link
Member

tomalec commented Jul 14, 2021

For the front-end tests/jest we can start with just --coverage, but I 👍 Coveralls

tomalec added a commit that referenced this issue Aug 3, 2021
Add report to .gitignore.
Please note, it only reports on touched files.

Partially addreses #864
@nima-karimi nima-karimi changed the title Add test coverage Add test coverage report Aug 31, 2021
@nima-karimi nima-karimi removed their assignment Aug 18, 2022
@mikkamp
Copy link
Contributor

mikkamp commented Jan 31, 2023

After updating to phpunit 9.5 in PR #1867, as long as we have a PHP version with xdebug installed then a coverage report can be produced as follows.

  1. Add the following section to phpunit.xml.dist
	<coverage>
		<include>
			<directory suffix=".php">./src</directory>
			<directory suffix=".php">./views</directory>
			<file>google-listings-and-ads.php</file>
		</include>
	</coverage>
  1. Setup tests: bin/install-wp-tests.sh <db_name> <db_user> <db_pass>
  2. Run the tests with a coverage report: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text

Example output:
image

@mikkamp
Copy link
Contributor

mikkamp commented Jun 15, 2023

Update: A codecov report has been added in #1915
So far this only covers PHP, we also do unit testing in JS which we could include in the coverage report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: technical debt This issue/PR represents/solves the technical debt of the project.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants