Make WordPress Core

Opened 4 years ago

Last modified 3 months ago

#41463 accepted enhancement

Improve REST API tests that don't perform any assertions

Reported by: johnbillion Owned by: johnbillion
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: needs-unit-tests needs-refresh
Focuses: rest-api Cc:

Description

There are a bunch of REST API tests that don't perform any assertions. This creates noise in the test results as they get marked as risky tests.

These tests are present because their test class extends the abstract WP_Test_REST_Controller_Testcase class, which requires several methods to be implemented which don't make sense for all REST API routes.

These tests can be improved so they do actually perform assertions related to their behaviour.

Attachments (1)

41463.diff (3.7 KB) - added by johnbillion 4 years ago.

Download all attachments as: .zip

Change History (10)

#1 @johnbillion
4 years ago

  • Owner set to johnbillion
  • Status changed from new to accepted

#2 @johnbillion
4 years ago

In 41176:

REST API: Add some missing assertions to various REST API tests.

See #41463

@johnbillion
4 years ago

#3 @johnbillion
4 years ago

In 41228:

REST API: Populate some missing tests from test cases which extend the controller test case.

See #41463

#4 @johnbillion
4 years ago

Blocked by #41604 and #41605

#5 @johnbillion
4 years ago

  • Milestone changed from 4.9 to Future Release

This ticket was mentioned in Slack in #core-restapi by spacedmonkey. View the logs.


3 months ago

#7 @spacedmonkey
3 months ago

  • Keywords needs-refresh added

The latest patch is from 4 years ago, making this ticket as needs a refresh.

#8 @zieladam
3 months ago

  • Keywords needs-refresh removed

Some time has passed and pulling a fresh list of tests with 0 assertions could be useful here. A fresh (as of today) PHPUnit report is available here:

https://github.com/WordPress/wordpress-develop/runs/3887182312

#9 @zieladam
3 months ago

  • Keywords needs-refresh added
Note: See TracTickets for help on using tickets.