Skip to content

JUnit result for PHPUnit#102

Closed
SimonHeimberg wants to merge 8 commits into
php-censor:masterfrom
SimonHeimberg:junitResult
Closed

JUnit result for PHPUnit#102
SimonHeimberg wants to merge 8 commits into
php-censor:masterfrom
SimonHeimberg:junitResult

Conversation

@SimonHeimberg

Copy link
Copy Markdown
Contributor

No description provided.

@SimonHeimberg SimonHeimberg changed the title Junit result for PHPUnit JUnit result for PHPUnit Jul 17, 2017
@SimonHeimberg

SimonHeimberg commented Jul 17, 2017

Copy link
Copy Markdown
Contributor Author

phpunit --log-json ... is removed in phpunit 6.0, so there must be used JUnit format for the results. It does not make sense to use JUnit before, because it lacks some information (skipped tests).

There is still a shortcoming: Skipped and ignored tests have no message in the current JUnit format (sebastianbergmann/phpunit#2740).
And there is only the dataset number when a test passed or is skipped (no values from dataProvider shown then).

And I would prefer to use the CommandExecutor to see if --log-json is supported. But I do not see a possibility to do this without writing to the log file. (I could disable logging, but not enable thereafter.) This is why exec is used currently.

@SimonHeimberg

Copy link
Copy Markdown
Contributor Author

Oops, I found an error. When there is output AND failure, the result may be wrong. I will fix it, but am already interested in feedback.

@corpsee

corpsee commented Jul 18, 2017

Copy link
Copy Markdown
Member

Thank you @SimonHeimberg for the work. I will review changes soon and will write feedback.

@SimonHeimberg

Copy link
Copy Markdown
Contributor Author

updated

  • fixed failure because of system-out element
  • add test for above
  • fixed test failures (in PhpUnitTest: testSingleConfigFile, testMuliConfigFile, testSingleDir, testMultiDir) (I saw this locally, but did not understand immediately that it was me who broke them)

@SimonHeimberg

Copy link
Copy Markdown
Contributor Author

the repo to generate phpunit_money* from is https://github.com/SimonHeimberg/testResultGenerating-php-censor

@corpsee

corpsee commented Jul 19, 2017

Copy link
Copy Markdown
Member

@SimonHeimberg Yesterday I started review/test your pull request and I will try to finish it at this week.

@corpsee

corpsee commented Jul 20, 2017

Copy link
Copy Markdown
Member

@SimonHeimberg I catched error on PHPUnit 6 (May be my tests will need update):

RUNNING PLUGIN: PHP Unit (Stage: Test)
Plugin options: {"priority_path":"global","config":["phpunit.xml"]}
Looking for binary: phpunit
Found in vendor/bin (global): phpunit
Looking for binary: phpunit
Found in vendor/bin (global): phpunit
Args: ["\/home\/corpsee\/Projects\/php-censor.local\/vendor\/bin\/phpunit %s %s","--log-junit \"\/home\/corpsee\/Projects\/php-censor.local\/runtime\/builds\/477_e9e1a\/jLog_oFVPbo\" --configuration \"\/home\/corpsee\/Projects\/php-censor.local\/runtime\/builds\/477_e9e1a\/phpunit.xml\" ",null]
Command: /home/corpsee/Projects/php-censor.local/vendor/bin/phpunit --log-junit "/home/corpsee/Projects/php-censor.local/runtime/builds/477_e9e1a/jLog_oFVPbo" --configuration "/home/corpsee/Projects/php-censor.local/runtime/builds/477_e9e1a/phpunit.xml"  
Warning: is_dir() expects parameter 1 to be a valid path, object given in /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php on line 56
Call Stack:
    0.0001     353128   1. {main}() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/phpunit:0
    0.0050    1057520   2. PHPUnit\TextUI\Command::main() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/phpunit:53
    0.0050    1057632   3. PHPUnit\TextUI\Command->run() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/src/TextUI/Command.php:136
    0.0177    2602096   4. PHPUnit\TextUI\TestRunner->getTest() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/src/TextUI/Command.php:159
    0.0177    2602096   5. is_dir() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php:56
Catchable fatal error: Object of class PHPUnit\Framework\TestSuite could not be converted to string in /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php on line 32
Call Stack:
    0.0001     353128   1. {main}() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/phpunit:0
    0.0050    1057520   2. PHPUnit\TextUI\Command::main() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/phpunit:53
    0.0050    1057632   3. PHPUnit\TextUI\Command->run() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/src/TextUI/Command.php:136
    0.0177    2602096   4. PHPUnit\TextUI\TestRunner->getTest() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/src/TextUI/Command.php:159
    0.0178    2602128   5. PHPUnit\TextUI\TestRunner->loadSuiteClass() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php:73
    0.0181    2620592   6. PHPUnit\Runner\StandardTestSuiteLoader->load() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php:130
    0.0181    2620592   7. str_replace() /home/corpsee/Projects/php-censor.local/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php:32

@corpsee

corpsee commented Jul 23, 2017

Copy link
Copy Markdown
Member

It was my fault. I reviewed and merged into master branch manualy. Thanks @SimonHeimberg!

@corpsee corpsee closed this Jul 23, 2017
@SimonHeimberg

SimonHeimberg commented Jul 24, 2017

Copy link
Copy Markdown
Contributor Author

to run php-censor itself with phpunit v6, #105 is necessary. But I get some fatal error as well (different ones). How did you set up your system? Update phpunit in composer.json of php-censor?

@corpsee

corpsee commented Jul 24, 2017

Copy link
Copy Markdown
Member

Yes, I updated PHPUnit in PHP Censor to v6 and used this feature - #104 (Used global PHPUnit instead of build local PHPUnit).

I don't see reason now to test PHP Censor itself with PHPUnit v6, I already tested your request on PHPUnit v6 repo as a project with tests for PHPUnit v6 😄

@corpsee

corpsee commented Jan 7, 2018

Copy link
Copy Markdown
Member

dancryer/PHPCI#1305

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants