简体   繁体   中英

phpunit does not find tests in directory

i am trying to execute all tests in subfolders of my test directory. This works locally on my computer but not on the integration server.

phpunit does not find the test files

hudson@slipstream:~/.hudson/jobs/stendhal_website/workspace$ phpunit tests
PHPUnit 3.4.5 by Sebastian Bergmann.
Time: 0 seconds, Memory: 4.50Mb
OK (0 tests, 0 assertions)

The test file, however, does exist and is readable:

hudson@slipstream:~/.hudson/jobs/stendhal_website/workspace$ find tests -name \*Test.php
tests/scripts/pharauroa/common/net/deserializerTest.php
hudson@slipstream:~/.hudson/jobs/stendhal_website/workspace$ ls -l tests/scripts/pharauroa/common/net/deserializerTest.php
-rw-r--r-- 1 hudson hudson 6957 Jul 17 12:54 tests/scripts/pharauroa/common/net/deserializerTest.php

I can start it by explicitly specifying it on the command line of phpunit:

hudson@slipstream:~/.hudson/jobs/stendhal_website/workspace$ phpunit tests/scripts/pharauroa/common/net/deserializerTest.php
PHPUnit 3.4.5 by Sebastian Bergmann.
.....
Time: 0 seconds, Memory: 5.00Mb
OK (5 tests, 32 assertions)

What I tried so far:

Using strace, I can see that phpunit recursively scans the tests directory and even stats the deserializerTest.php file. But it does not open

"phpunit tests" works fine on my local computer. Both computers are running Ubuntu Lucid 10.04 and phpunit 3.4.5. The server is running within a chroot.

I tried to use

phpunit `find tests -name \*.php`

but phpunit only pays attention to the first parameter.

I know that it is possible to write suite classes but that seems like a maintenance nightmare. It feels like I am missing something obvious.

I had the same issue with hudson/phpunit, you should set the "HUDSON_HOME" environment variable, and give a new home directory without any "." in the path. (So surely move it from ~/.hudson !)

See: http://wiki.hudson-ci.org/display/HUDSON/Administering+Hudson

I've tried to reproduce this with PHPUnit 3.4.5 and the current Version 3.4.15 on Ubunutu 10.04 and it works in both so upgradeing might not help.

Like you said it "should" work the way you described it. My best guess is that there maybe is an "phpunit.xml" with some ignore flags that gets automatically included and is only present on the Server, even so thats a far shot.

You may also be able to find additional help on freenode irc in the #phpunit Channel.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM