WebAssert Tests do not actually test all methods

Created on 19 July 2024, about 2 months ago
Updated 23 August 2024, 16 days ago

Problem/Motivation

In 📌 Convert WebAssertTest to a Unit test Needs review it was discovered that a few methods that several test methods do not actually make assertions so the test coverage of the tests do not actually work.

These three are identified as claiming coverage but not actually covering them:

  • linkExists
  • assertEscaped
  • responseContains

Further there are several methods not covered.

  • optionExists
  • buildXPathQuery
  • optionNotExists
  • titleEquals
  • assert
  • fieldDisabled
  • fieldEnabled
  • hiddenFieldExists
  • hiddenFieldNotExists
  • hiddenFieldValueEquals
  • hiddenFieldValueNotEquals
  • statusMessageExists
  • statusMessageNotExists
  • statusMessageContains
  • statusMessageNotContains
  • buildStatusMessageSelector
  • responseHeaderEquals
  • pageTextContains
  • fieldValueEquals
  • selectExists

Steps to reproduce

Break linkExists (e.g. throw an exception or other breakage)
Run tests
Tests pass

From #3454092-26: Convert WebAssertTest to a Unit test
Found out why those assert methods that make no assertions are passing in BrowserTestBase tests:

In BrowserTestBase::setUp:

// Ensure that the test is not marked as risky because of no assertions. In
// PHPUnit 6 tests that only make assertions using $this->assertSession()
// can be marked as risky.
$this->addToAssertionCount(1);

Proposed resolution

Ensure mentioned methods have full coverage.

Remaining tasks

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
PHPUnit 

Last updated about 11 hours ago

Created by

🇺🇸United States nicxvan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024