by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Eric COURTIAL
    @ecourtial
    OK (1 test, 1 assertion)
    Maks Rafalko
    @maks-rafalko
    :|
    it’s weird. I guess executed tests are not the same as “original” one for some reason
    ok, it would be extremely helpful if you can create a reproducible small repository
    Eric COURTIAL
    @ecourtial
    I will
    Maks Rafalko
    @maks-rafalko
    thank you so much
    Eric COURTIAL
    @ecourtial
    Have a good day and thank you :)
    Maks Rafalko
    @maks-rafalko
    cheers :)
    Tomas Norre
    @tomasnorre_twitter

    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?

    Maks Rafalko
    @maks-rafalko

    Hi Tomas.

    1. Without Infection, do you run phpunit separately for unit & functional tests?
    2. Am I correct you are running sucessfully Infection for unit tests, and Infection for functional tests - separately?
    3. Am I right you want to combine results of these 2 separate Infection runs and get a combined MSI etc.? Just like PHPUnit can combine coverage reports.

    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?

    Infection can not combine results of 2 separate run, but you can create a feature request oin GitHub so we can discuss it
    we need a new report (let’s say json) to be able to programmatically analyze it and combine, because now all our generated reports are human readable, but not machine-friendly
    Tomas Norre
    @tomasnorre_twitter
    1. Yes I have two tests runs, one for each.
    2. Correct
    3. Yes.
    Yeah that makes sense, but as I see it, it wouldn't give me a combined score anyone, as the score is displayed on run-time.
    I would have no problem in having one phpunit.xml that took care of bootstrapping for both unit and functional, but as they have seperate bootstrap setup I haven't found an option to do this with one phpunit.xml file.
    Maks Rafalko
    @maks-rafalko
    I see. Then it’s not possible to get combined MSI unfortunately
    Tomas Norre
    @tomasnorre_twitter

    That's a shame, I would like to have it in my CI so a combined score would be prefered, as MSI 50% for unit and MSI 50% for functional could mean a total of 100% but also a 50%..

    I prefer unit tests too, but not feaseble for all tests.

    Tomas Norre
    @tomasnorre_twitter

    I will start with implementing it for our unit-tests then, we have more unit than functional, and it's better to have some mutation tests than none.

    Thanks for your help.

    Maks Rafalko
    @maks-rafalko
    no problem, thanks
    Tomas Norre
    @tomasnorre_twitter

    I have a file in excludes in config.

    "source": {
            "directories": [
                "Classes"
            ],
            "excludes": [
                "Classes/Worker/CrawlerWorker.php"
            ]
        },

    But it still complains about a problem with the file, am I doing something wrong.

    Maks Rafalko
    @maks-rafalko
    what Infection version do you use?
    Tomas Norre
    @tomasnorre_twitter
    Will try with the never version. Don't know why i'm on an old one.
    It's due to my PHP Version, only at 7.2
    Maks Rafalko
    @maks-rafalko

    https://infection.github.io/guide/usage.html#Configuration-settings

    Paths under excludes key are relative to the source.directories folders.

    so I guess it should be Worker/CrawlerWorker.php
    Tomas Norre
    @tomasnorre_twitter
    ok.. Doesn't change the problem here.
    Tomas Norre
    @tomasnorre_twitter
    It looks like the Source->directories and excludes aren't evaluated before the error comes, it's as class-loading problem with a class that not exist.
    Tomas Norre
    @tomasnorre_twitter
    I'll remove the part not working for now. Only have the next 24 hours for this Hackathon, so better have some progress :)
    Tomas Norre
    @tomasnorre_twitter
    Can someone explain me why this mutation is done? To me it looks like invalid code not a possible code change.
    -        return ['depth' => [0 => $this->get ...
    +        return ['depth' => [0 > $this->get ...
    it's the arrayItem Mutation.
    Maks Rafalko
    @maks-rafalko

    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?

    Tomas Norre
    @tomasnorre_twitter
    Not invalid, just read it wrong. Thanks for your explaination.
    Matthias Leopold
    @Matleo

    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.

    Neither "AppBundle\/PHPUnit\/Mocks\/Traits\/**" nor "**\/Traits\/**" (we want to exclude all Traits), does the job.
    What are we doing wrong?
    This message was deleted
    Matthias Leopold
    @Matleo
    Our infection.json.dist looks as follows
    {
    "source": {
    "directories": [
    "src\/"
    ],
    "excludes": [
    "**\/Tests\/*",
    "AppBundle\/PHPUnit\/Mocks\/Traits\/**"
    ]
    },
    "timeout": 10,
    "logs": {
    "text": "artifacts\/infection\/infection.log",
    "summary": "php:\/\/stdout",
    "perMutator": "artifacts\/infection\/per-mutator_blabla.md"
    },
    "tmpDir": "var\/temp",
    "phpUnit": {
    "configDir": "var\/infection"
    },
    "mutators": {
    "@default": true,
    "@function_signature": false
    },
    "testFramework":"phpunit",
    "testFrameworkOptions": "-vvv"
    }
    Maks Rafalko
    @maks-rafalko

    hello!

    have you tried "excludes": [“SampleBrandWithArticlesTrait.php”]?

    it’s weird, to be honest. If you could try creating a minimal reproducing example repository - feel free to open an issue. Probably this is just a bug that we are not aware of
    Matthias Leopold
    @Matleo
    Wow. That actually worked. Thank you
    We still would like to exclude all Traits though. Any Ideas?
    Maks Rafalko
    @maks-rafalko

    AppBundle\/PHPUnit\/Mocks\/Traits\/*.php does it work?

    I still think there might be an issue / bug here. So fell free to open a ticket

    Matthias Leopold
    @Matleo
    Does not work
    Matthias Leopold
    @Matleo
    I will open an Issue on this concern next week.
    Thank you for your help!
    Maks Rafalko
    @maks-rafalko
    thanks!
    Valentin
    @Vallelorand_twitter
    Hi,
    I have a problem with this awesome library :
    • Output
      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.
    • Config
      {
       "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.
      I haven't seen similary error on the web, it's weird, I'm lost.
    Alexey Kopytko
    @sanmai
    Hi, would you mind opening an issue so someone can have a closer look?
    Please include phpunit.xml too.
    Valentin
    @Vallelorand_twitter
    Okay thanks, I will do that
    <?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>