Problems with unit tests
| From: | Bob McConnell | Date: | Wed, 01 Jul 2009 15:08:48 +0000 |
| Subject: | Problems with unit tests | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-294796@lists.php.net to get a copy of this message | ||
I am using test-harness.php (PHP TAP Test Harness 1_0_0_BETA) and
test-more.php to write some unit tests for several libraries of
functions. These tests need to run from a MS-Windows CLI so they can be
run on our desktops for now and can be added to the automated build
process later.
I have written my first tests using test-more.php to generate TAP
compliant results, and they work as expected (see below - yes, both
tests should fail). But when I run them with test-harness.php, the
reported results are wrong (also below). The harness reports all tests
passed, even if they didn't.
After doing some digging, I found Bug #44908, which seems to be related.
It appears the interpreter on MS-Windows is not creating the pipe file
for STDOUT, so the harness never sees the results from the actual tests.
I also tried using the Perl Test::Harness to run the scripts and get the
same error message there. Both harnesses appear to ignore the error
count returned as the process exit value as well. But I am not sure if
that is true or they just never saw it.
Has any workaround been identified for this problem?
Is there another mailing list that might be a more appropriate forum for
this issue?
Thank you,
Bob McConnell
------9<---------------------------------
D:\project\workspace\t>ver
Microsoft Windows XP [Version 5.1.2600] <<- XP Pro 2002 w/SP2
D:\project\workspace\t>php -v
PHP 5.2.10 (cli) (built: Jun 17 2009 16:16:57)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
D:\project\workspace\t>php testSessionKV.php
1..2
not ok 1 - Should fail
# Failed test (D:\project\workspace\t\testSessionKV.php at line 13)
not ok 2 - Old KV pair
# Failed test (D:\project\workspace\t\testSessionKV.php at line 24)
# Looks like you failed 2 tests of 2.
D:\project\workspace\t>php test-harness.php -v
testSessionKV.php.................................ok
Could not open input file: D:
All test scripts passed! All subtests passed!
D:\project\workspace>ren testSessionKV.php testSessionKV.t
D:\project\workspace>cd ..
D:\MMID\workspace\t>perl -v
This is perl, v5.10.0 built for MSWin32-x86-multi-thread <<- Camelbox
Copyright 1987-2007, Larry Wall
D:\project\workspace>set HARNESS_PERL=php
D:\project\workspace>perl -MTest::Harness -e "@ARGV= map glob, @ARGV
if $^O =~ /^MSWin/; runtests @ARGV;" t/*.t
t/testSessionKV....Could not open input file: print join qq[\n], @INC
FAILED before any test output arrived
FAILED--1 test script could be run, alas--no output ever seen
------9<---------------------------------