3

These are my configs:

phpunit.xml

    <!-- http://phpunit.de/manual/4.1/en/appendixes.configuration.html -->
    <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
             backupGlobals="false"
             colors="true"
             bootstrap="../usr/core/autoload.test.php"
    >
        <php>
            <ini name="error_reporting" value="-1" />
            <server name="KERNEL_DIR" value="usr/core/" />
        </php>

        <testsuites>
            <testsuite name="Api">
                <directory>../usr/Project/Api/*Bundle/Tests</directory>
            </testsuite>
            <testsuite name="Backend">
                <directory>../usr/Project/Backend/*Bundle/Tests</directory>
            </testsuite>
            <testsuite name="CMS">
                <directory>../usr/Project/CMS/*Bundle/Tests</directory>
            </testsuite>
            <testsuite name="Console">
                <directory>../usr/Project/Console/*Bundle/Tests</directory>
            </testsuite>
            <testsuite name="Im">
                <directory>../usr/Project/Im/*Bundle/Tests</directory>
            </testsuite>
            <testsuite name="Library">
                <directory>../usr/Project/Library/*Bundle/Tests</directory>
            </testsuite>
            <testsuite name="Registration">
                <directory>../usr/Project/Registration/*Bundle/Tests</directory>
            </testsuite>
            <testsuite name="TestSuite">
                <directory>../usr/tests</directory>
            </testsuite>
        </testsuites>

        <filter>
            <whitelist addUncoveredFilesFromWhitelist="true">
                <directory>usr</directory>
                <exclude>
                    <directory>../usr/*Bundle/Resources</directory>
                    <directory>../usr/*/*Bundle/Resources</directory>
                    <directory>../usr/*/Bundle/*Bundle/Resources</directory>
                </exclude>
            </whitelist>
        </filter>
    </phpunit>

and ant configuration:

<target name="phpunit"
        unless="phpunit.done"
        description="Run unit tests with PHPUnit">
    <exec executable="${phpunit}" resultproperty="result.phpunit" taskname="phpunit">
        <arg value="--configuration"  path="${basedir}/build/phpunit.xml"/>
        <arg value="--coverage-clover"  path="${basedir}/build/logs/clover.xml"/>
        <arg value="--log-junit" path="${basedir}/build/logs/phpunit.xml"/>
    </exec>

    <property name="phpunit.done" value="true"/>
</target>

so far everything works fine. But when I execute in in jenkins I get the following message:

    Clover xml file does not exist in: /var/lib/jenkins/workspace/Project5FullBuild called: build/logs/clover.xml and will not be copied to: /var/lib/jenkins/jobs/Project5FullBuild/builds/39/cloverphp/clover.xml
    Could not find 'build/coverage/build/logs/clover.xml'.  Did you generate the XML report for Clover?

I checked the logs directory. No clover.xml existed. I also already checked several other google hints, but nothing helped so far. What am I missing?

2 Answers 2

1

If the whitelisting in your config file does not yield files, phpunit will not generate a coverage xml file, to my knowledge.

Try modifying your filter element to make sure it includes files, e.g.:

<filter>
    <whitelist processUncoveredFilesFromWhitelist="true">
        <directory suffix=".php">somedir</directory>
    </whitelist>
</filter>
Sign up to request clarification or add additional context in comments.

Comments

1

In my case, was necessary to install php-xdebug module, otherwise it did not work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.