Что вызывает различия в отчетах о покрытии кода PHPUnit для одного и того же кода?

У меня есть проект PHP с некоторым модулем и некоторые интеграционные тесты. Я развернул его с помощью Jenkins: локально на моей виртуальной машине Ubuntu и на тестовом сервере в Windows Server 2008 r2.

build.xmlс и phpunit.xmls для локальной виртуальной машины и тестового сервера в целом идентичны (различия только в косых чертах и ​​в том, как службы phpunit называются, с. ниже). Но отчеты о покрытии кода показывают разные результаты. Локально покрытие кода составляет примерно 10% выше, чем на сервере:

локальная виртуальная машина (Ubuntu)

Покрытие кода PHPUnit: Линии 90.24%, Функции и Методы 95.31%, Классы и Черты 85.00%

введите описание изображения здесь

Clover PHP Отчет о покрытии: Охват кода — 77% (5295/6880 элементов): 77% (5295/6880 элементов), методы 79,3%, утверждения 76,5%

введите описание изображения здесь

тестовый сервер (Windows Server 2008 r2)

Покрытие кода PHPUnit: Линии 81,89%, Функции и Методы 85,25%, Классы и Черты 57,81 %%

введите описание изображения здесь

Clover PHP Отчет о покрытии: Охват кода — 77% (5295/6880 элементов): 77% (5295/6880 элементов), методы 79,3%, утверждения 76,5%

введите описание изображения здесь

Что может вызвать такую ​​разницу и как ее исправить?


больше информации

местный build.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project name="MyProject" default="full-build">
...
<property name="phpunit" value="./vendor/bin/phpunit" />
<target name="full-build" depends="prepare,static-analysis,phpdox,phpunit,-check-failure" description="Performs static analysis, runs the tests, and generates project documentation." />
...
<target name="phpunit" unless="phpunit.done" depends="prepare" description="Run unit tests with PHPUnit">
<exec executable="${phpunit}" resultproperty="result.phpunit" taskname="phpunit">
<arg value="--configuration" />
<arg path="${basedir}/phpunit.xml" />
</exec>
<property name="phpunit.done" value="true" />
</target>
<target name="-check-failure">
<fail message="PHPUnit did not finish successfully">
<condition>
<not>
<equals arg1="${result.phpunit}" arg2="0" />
</not>
</condition>
</fail>
</target>
</project>

build.xml на сервере:

<?xml version="1.0" encoding="UTF-8"?>
<project name="MyProject" default="full-build">
...
<property name="phpunit" value="vendor\phpunit\phpunit\phpunit" />
<target name="full-build" depends="prepare,static-analysis,phpdox,phpunit,-check-failure" description="Performs static analysis, runs the tests, and generates project documentation." />
...
<target name="phpunit" unless="phpunit.done" depends="prepare" description="Run unit tests with PHPUnit">
<exec executable="cmd" resultproperty="result.phpunit" taskname="phpunit">
<arg value="/c" />
<arg value="phpdbg" />
<arg value="-qrr" />
<arg value="${phpunit}" />
<arg value="--configuration" />
<arg path="${basedir}/phpunit.xml" />
</exec>
<property name="phpunit.done" value="true" />
</target>
<target name="-check-failure">
<fail message="PHPUnit did not finish successfully">
<condition>
<not>
<equals arg1="${result.phpunit}" arg2="0" />
</not>
</condition>
</fail>
</target>
</project>

местный phpunit.xml:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"backupGlobals="false"backupStaticAttributes="false"bootstrap="test/Bootstrap.php"cacheTokens="false"colors="true">
<php>
<env name="RUNTIME_CONTEXT" value="testing"/>
</php>
<testsuites>
<testsuite name="unit-app-only">
<directory suffix="Test.php">test/Unit</directory>
</testsuite>
<testsuite name="integration-app-only">
<directory suffix="Test.php">test/Integration</directory>
</testsuite>
<testsuite name="app-lib">
<directory suffix="Test.php">vendor/my-lib/mlb-common-lib/tests</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-crap4j" target="build/logs/crap4j.xml"/>
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">module/**/src</directory>
<directory suffix=".php">vendor/my-lib/**/src</directory>
<exclude>
<directory suffix=".php">vendor/my-lib/**/tests</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

phpunit.xml на сервере:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"backupGlobals="false"backupStaticAttributes="false"bootstrap="test/Bootstrap.php"cacheTokens="false"colors="true">
<php>
<env name="RUNTIME_CONTEXT" value="testing"/>
</php>
<testsuites>
<testsuite name="unit-app-only">
<directory suffix="Test.php">test\Unit</directory>
</testsuite>
<testsuite name="integration-app-only">
<directory suffix="Test.php">test\Integration</directory>
</testsuite>
<testsuite name="app-lib">
<directory suffix="Test.php">vendor\my-lib\mlb-common-lib\tests</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-html" target="build\coverage"/>
<log type="coverage-clover" target="build\logs\clover.xml"/>
<log type="coverage-crap4j" target="build\logs\crap4j.xml"/>
<log type="junit" target="build\logs\junit.xml" logIncompleteSkipped="false"/>
</logging>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">module\**\src</directory>
<directory suffix=".php">vendor\my-lib\**\src</directory>
<exclude>
<directory suffix=".php">vendor\my-lib\**\tests</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

ОБНОВИТЬ

Версии программного обеспечения:

локальная Ubuntu VM

  • PHP 7.0.3
  • Xdebug 2.4.0RC4
  • PHPUnit 6.2.2

Windows 2008 сервер

  • PHP 7.0.2
  • PHPUnit 6.2.2

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector