Comments (10)
A bump, i wonder how to deal with this:
public static function createRandom(): string
{
return sha1(uniqid("", true));
}
1) \Humbug\Mutator\Boolean\TrueValue
--- Original
+++ New
@@ @@
{
- return uniqid("", true);
+ return uniqid("", false);
}
I do realize you could extract the uniqid to a public and measure length. However that creates bloat in code because of the test suite.
from humbug.
What is the goal of this ? Forbidding to apply mutations here means you are forbidding to check whether your testsuite prevents mistakes in this code
from humbug.
I see no upside to such a change. The point of Mutation Testing is to generate a log of mutations that should be investigated to see whether improvements to unit tests are feasible. It is taken for granted that a Human will review the logs now and again, and have some understanding of when errors, false positives, etc. may be ignored. Having a facility to disable testing of specific source code line ranges, within the source code itself no less, would undermine this.
from humbug.
But with always some errors in your result with false positives, the investigation time increases.
Every new member or from time to time you need to check. In PHPUnit I can set a test to ignore or similar. In the case above, it will always results in an error, but the test covered it completly.
from humbug.
Main thing to note is that errors are a positive outcome - it's a good result! We allow errors to be logged because Humbug may also produce them internally and we want to know when that happens.
I think a better approach would be to log everything, and from the log extract a "false positive" list that could flag future similar false positives to be added in subsequent logs under a "Known False Positive" header, e.g. a simple md5 hash ID of mutator, file, line and diff. This is fairly complicated for the end result, so I can't make it a priority at this time when I need to be focusing on testing and getting an initial version out the door.
from humbug.
Hi,
I tested a little bit and this code in the "mutates" function seems to work. Further testing is needed, but I think this is a good aproach.
$humbugMutatorIgnoreEndIndex = 0;
$humbugMutatorIgnoreStartIndex = 0;
foreach ($tokens as $key => $token) {
if (is_array($token)) {
$token = $token[1];
}
$humbugMutatorIgnoreStart = strpos($token, '@humbugMutatorIgnoreStart');
if ($humbugMutatorIgnoreStart !== false) {
$humbugMutatorIgnoreStartIndex = $key;
}
$humbugMutatorIgnoreEnd = strpos($token, '@humbugMutatorIgnoreEnd');
if ($humbugMutatorIgnoreEnd !== false) {
$humbugMutatorIgnoreEndIndex = $key;
}
if ($humbugMutatorIgnoreEndIndex < $humbugMutatorIgnoreStartIndex &&
$index > $humbugMutatorIgnoreStartIndex) {
return false;
}
if ($key > $index) {
break;
}
}
from humbug.
If the actual index/token is after a @humbugMutatorIgnoreStart the mutator will be ignored.
(And the @humbugMutatorIgnoreEnd is not before the index, too)
from humbug.
Closing this. I really cannot figure out the point of such a change other than removal of false positives and there should be better ways of doing that during reporting.
from humbug.
@arnovr that's exactly what I'm running into... I now have to live with 1 mutation always surviving... sad.
from humbug.
This prevents us from using Humbug as part of our continuous delivery process. A simple ignore annotation would do. The fact that some issues were ignored could even be part of the report.
from humbug.
Related Issues (20)
- Make Humbug tests up and running HOT 3
- Communication channels HOT 8
- Path to PHPUnit not properly escaped HOT 2
- PHPUnit Mock and Prophecy objects shoudn't be mutated HOT 5
- [DISCUSS] Roadmap for Humbug 2.0 HOT 7
- Add behat scenario where there are no tests to run against mutations. HOT 1
- Resolve Appveyor failed builds for PHP 7.0
- PHPUnit Test Listeners are technically read-only (not enforced). We need another means of manipulating suite execution order and suite filtering. HOT 2
- PHAR build error - solution to be documented
- [DISCUSS] Dependency interference/Initial run failures HOT 2
- Make phpdbg a first class citizen HOT 1
- Document whether Humbug runs processes in parallel
- Stripping PHPUnit configuration of elements HOT 3
- Document preferred non-PHAR, non-global installation as using composer-bin to isolate dependencies
- Humbug fails with PHPUnit stderr setting
- Is there a way to configure which PHPUnit test suite to run? HOT 2
- Incompatibility with php-vcr (or other libraries using stream_wrapper_register) HOT 2
- You need to install and enable xdebug in order to.. even with xdebug installed HOT 2
- TImeouts - how to prevent them
- Humbug reports uncovered mutants on a 100% covered codebase HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from humbug.