【问题标题】:Infection Throws Exeption, but why, and how to handle it?感染引发异常,但为什么以及如何处理呢?
【发布时间】:2020-03-22 09:41:06
【问题描述】:

任务是错误确实机器人解释了该问题。

错误:

在运行 Infection 之前,项目测试必须处于通过状态。
Infection 以随机顺序运行测试套件。确保您的测试没有隐藏的依赖项。

您可以将这些属性添加到phpunit.xml 以检查它:

如果您不想让 Infection 以随机顺序运行测试,请将 executionOrder 设置为某个值,例如

检查执行的命令以确定问题:'/usr/bin/php7.2''-d''zend_extension=xdebug.so''/mnt/e/dev/bin/phpunit''--configuration' '/mnt/e/dev/var/infection/
感染/phpunitConfiguration.initial.infection.xml''-vvv'
PHPUnit 报告退出代码为 143。
请参阅以下 PHPUnit 的输出:
标准错误:

无法加载 Xdebug - 它已经加载了

我尝试执行以下语句很简单:

vendor/bin/infection --threads=10 --only-covered

但是当我尝试那个错误中解释的语句时,测试将成功运行,但这只是我没有突变测试的单元测试。

这是我的 phpunit.xml.dist 中 phpunit 标签的摘要

<phpunit .... backupGlobals="false" colors="false" bootstrap="/mnt/e/dev/RESTler/config/bootstrap.php" executionOrder="random" resolveDependencies="true" cacheResult="false" stopOnFailure="true" stderr="false" .../>

版本是:

  • PHPUnit 版本:7.5.15
  • PHP 7.2.22-1+ubuntu18.04.1+deb.sury.org+1
  • 感染 - PHP 变异测试框架 0.14.2
  • Symfony 框架 4.2

有没有人暗示我可以尝试什么或我的错误在哪里?

【问题讨论】:

    标签: php phpunit symfony4 mutation-testing infection


    【解决方案1】:

    在我漫长的旅程之后,我发现了一些东西。 但不知道为什么它不适用于我的配置。

    在我从php.ini 中删除xdebug.so 之后,这对我来说是正确的声明

    infection --threads=10 --only-covered --initial-tests-php-options='-d zend_extension=xdebug.so'
    

    我以为这就够了,但后来出现了 memory_limit 问题,可以用同样的方式修复

    infection --threads=10 --only-covered --initial-tests-php-options='-d zend_extension=xdebug.so -d memory_limit=-1'
    

    现在它运行了,我有一些待办事项:)

    .: 被杀, M: 逃脱, S: 未发现, E: 致命错误, T: 超时

    .......M..MMMMMMMM.M.M.MMM.MMMM.M.MMMMMMMM.MMMM.M (50 / 89) .....MM.......MMMMMM.MMMM.... (89 / 89)

    产生了 89 个突变:

      45 mutants were killed
    
       0 mutants were not covered by tests
    
      44 covered mutants were not detected
    
       0 errors were encountered
    
       0 time outs were encountered
    

    指标:

       Mutation Score Indicator (MSI): 50%
       Mutation Code Coverage: 100%
       Covered Code MSI: 50%
    

    如果有人使用 phpdbg 而不是 xdebug 并且有 memory_limit 问题,对我来说,如果我在我的 /etc/php/7.3/phpdbg/php.ini 中为 phpdbg 覆盖新的 php.ini,它就可以工作

    我希望这里的这篇文章再次对其他人有所帮助。我不先删除它。也许有一天会换一个模组。

    【讨论】:

      猜你喜欢
      • 2016-06-29
      • 2011-06-09
      • 1970-01-01
      • 1970-01-01
      • 2011-07-06
      • 2020-12-03
      • 2013-03-27
      • 1970-01-01
      • 2020-11-30
      相关资源
      最近更新 更多