Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Junit result excludes certain failure types #1317

Closed
drobertduke opened this issue Jul 3, 2014 · 3 comments
Closed

Junit result excludes certain failure types #1317

drobertduke opened this issue Jul 3, 2014 · 3 comments

Comments

@drobertduke
Copy link

When tests are not marked public or their matching data providers cannot be found, they are marked as failed in the command line output. However, they are not marked failed in the junit result. If tests are marked failed on the command line output, I think they should be marked failed in the junit result.

<?php

class Failure_Test extends PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider dataprovider_that_does_not_exist
     */
    public function test_data_provider($param)
    {
        $this->assertFalse(true);
    }

    private function test_private_function()
    {
        $this->assertFalse(true);
    }
}
$ phpunit --log-junit failure_test.xml Failure_Test.php
PHPUnit 4.1.3 by Sebastian Bergmann.

Configuration read from [...]/phpunit.xml

FF

Time: 128 ms, Memory: 9.50Mb

There were 2 failures:

1) Warning
The data provider specified for Failure_Test::test_data_provider is invalid.
Method dataprovider_that_does_not_exist does not exist

phar:///usr/local/Cellar/phpunit/4.1.3/libexec/phpunit-4.1.3.phar/phpunit/TextUI/Command.php:179
phar:///usr/local/Cellar/phpunit/4.1.3/libexec/phpunit-4.1.3.phar/phpunit/TextUI/Command.php:132

2) Warning
Test method "test_private_function" in test class "Failure_Test" is not public.

phar:///usr/local/Cellar/phpunit/4.1.3/libexec/phpunit-4.1.3.phar/phpunit/TextUI/Command.php:179
phar:///usr/local/Cellar/phpunit/4.1.3/libexec/phpunit-4.1.3.phar/phpunit/TextUI/Command.php:132

FAILURES!
Tests: 2, Assertions: 0, Failures: 2.
$ cat failure_test.xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="Failure_Test" file="/box/www/current_local/test/php/integration/modular/ssf/ssf-legacy/legacy/helpers/URL_Test.php" tests="0" assertions="0" failures="0" errors="0" time="0.000000">
    <testsuite name="Failure_Test::test_data_provider" tests="0" assertions="0" failures="0" errors="0" time="0.000000"/>
  </testsuite>
</testsuites>
@dbellettini
Copy link

👍

1 similar comment
@josephharrington
Copy link

👍

@tjlee0909
Copy link

👍

Having a non-zero exit code but having a success JUnit-result file seems wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants