2020-12-21 15:38:52 +01:00
When a test fails due, for example, to infrastructure issues, you might want to ignore it temporarily. But without some kind of notation about why the test is being ignored, it may never be reactivated. Such tests are difficult to address without comprehensive knowledge of the project, and end up polluting their projects.
2021-02-02 15:02:10 +01:00
2020-12-21 15:38:52 +01:00
This rule raises an issue on each test that is marked as incomplete or skipped without a message explaining the reasoning behind it.
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,php]
2020-12-21 15:38:52 +01:00
----
protected function setUp() {
if (!extension_loaded('mysqli')) {
$this->markTestSkipped(); // Noncompliant
}
}
public function testSomething()
{
$this->assertTrue($result->isValid());
$this->markTestIncomplete(); // Noncompliant
}
----
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,php]
2020-12-21 15:38:52 +01:00
----
protected function setUp() {
if (!extension_loaded('mysqli')) {
$this->markTestSkipped( 'The MySQLi extension is not available.' ); // Compliant
}
}
public function testSomething()
{
$this->assertTrue($result->isValid());
$this->markTestIncomplete( 'Testing result validation is incomplete.' ); // Compliant
}
----
2021-06-02 20:44:38 +02:00
2021-06-03 09:05:38 +02:00
ifdef::env-github,rspecator-view[]
2021-09-20 15:38:42 +02:00
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
2021-06-08 15:52:13 +02:00
'''
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]