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

Mutant & Mutation tweaks #1207

Closed
wants to merge 2 commits into from
Closed

Conversation

theofidry
Copy link
Member

@theofidry theofidry commented Mar 24, 2020

I don't think there is a need to keep a duplicated method hence the removal of:

  • Mutant::isCoveredByTests()
  • Mutant::getTests()

I also propose to rename Mutation::isCoveredByTests() to hasTests() or alternatively isExecutedByTests() to avoid the "coverage" notion confusion.

Mutation::getAllTests() also has been renamed getTests(), since it's unclear otherwise whether it's all the tests for the mutations or all the tests in general. Removing just implies the tests for the mutation

@theofidry theofidry changed the title Remove Mutant::isCoveredByTests() and rename Mutation::isCoveredByTests() to hasTests() Mutant & Mutation tweaks Mar 24, 2020
@@ -110,7 +110,7 @@ public function collect(MutantExecutionResult ...$executionResults): void
break;

case DetectionStatus::NOT_COVERED:
$this->notCoveredByTestsCount++;
$this->notExecutedByTestsCount++;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm -1 on this renaming

  • it's clear what covered means, I don't think there is any confusion in "coverage notion"
  • now it's consfusing why the property is named notExecutedByTestsCount, but the detection status is NOT_COVERED

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's clear what covered means,

It's not, because it is not covered. The line code coverage only guarantees that a line is executed by a given test, it does not mean this test covers this line.

Also there was a discussion recently with the other mutation testing tools about an alternative to the kill/escape vocabulary and the resounding candidate was covered/uncovered which is going to be even more confusing if we keep those words with the line coverage

I totally agree with you about the detection status, I would like to change it, but that requires a bit more refactoring affecting the UI as well hence I left it alone for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not, because it is not covered. The line code coverage only guarantees that a line is executed by a given test, it does not mean this test covers this line.

I don't agree. I know the difference between types of coverage, and PHPUnit has line coverage, which exactly means that line is covered as soon as any of the opcode is executed.

So from PHPUnit point of view - line is covered. And we use only line coverage in PHP

@@ -150,16 +150,15 @@ public function getMutatedNode(): MutatedNode
return $this->mutatedNode;
}

// TODO: hasTest()?
public function isCoveredByTest(): bool
public function hasTests(): bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@theofidry
Copy link
Member Author

Closed in favour of #1209

@theofidry theofidry closed this Mar 29, 2020
@theofidry theofidry deleted the refactor/mutant branch March 29, 2020 11:08
@maks-rafalko maks-rafalko mentioned this pull request Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants