Hi there. .
I'm still quite new to infection/mutation tests. I'm working with TYPO3 and we have some both unit and functional tests, where the functional are depending on the database and therefore a different bootstrap.
Does a way exists to have to config-files, one for unit and one for funtional? I haven't managed to make one phpunit.xml.dist file that contains bootstraping for both.
If I config my infection for unit-tests it works and if I do it for functional it works too, but haven't found a way to either combine the scores/results or the configuration to be done with one execution.
Do you have any hints on this?
Hi Tomas.
phpunit
separately for unit & functional tests?Does a way exists to have to config-files, one for unit and one for funtional?
you can have 2 files: infection.unit.json
, infection.functional.json
and run Infection like
infection —configuration=infection.unit.json —test-framework-options=“-c phpunit.unit.xml"
infection —configuration=infection.functional.json —test-framework-options=“-c phpunit.functional.xml"
does it make sense?
https://infection.github.io/guide/usage.html#Configuration-settings
Paths under excludes key are relative to the source.directories folders.
Worker/CrawlerWorker.php
well, this mutation initates the type developer can make. Instead of key 0 (in general key N
with the value of type X
you will have and integered key with boolean
value
if your test doesn’t check the structure of the array and doesn’t catch this mistake - something wrogn with the test
To me it looks like invalid code
Why is the code invalid? Does it produce syntax error or warning?
Hello there :)
I am part of a small developer team in the swiss health industry and absolutely love the idea of infection testing.
We are currently using it in the backend project for our E-Commerce platform, but are facing a problem when trying to exclude certain Classes from the infection test:
In the github.io documentation it says "Paths under excludes key are relative to the source.directories folders."
In our Project we have a File named "src/AppBundle/PHPUnit/Mocks/Traits/SampleBrandWithArticlesTrait.php" where "src" is specified as our "source.directories".
Now I cannot manage to exclue this file from being used for the infection tests.
Running initial test suite...
PHPUnit version: 8.5.8
4 [============================] 24 secs
In NoLineExecuted.php line 47:
No line of code was executed during tests. This could be due to "@covers" annotations or your
PHPUnit filters not being set up correctly.
{
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "php://stdout"
},
"tmpDir": "cache/infection",
"mutators": {
"@default": true
},
"initialTestsPhpOptions": "-d zend_extension=xdebug.so"
}
There is not @covers annotations (it's a big project ) and no difference when I comment the filter flag in phpunit.xml.<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
bootstrap="bootstrap-phpunit.php"
verbose="false"
backupGlobals="false"
backupStaticAttributes="false"
convertErrorsToExceptions="false"
convertNoticesToExceptions="false"
convertWarningsToExceptions="false"
failOnWarning="true"
timeoutForSmallTests="5"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
beStrictAboutTestsThatDoNotTestAnything="true"
>
<filter>
<whitelist processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>