473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Can't addFile() in SimpleTest Test Suite

Hey guys -

I have a test suite that's working when I include a test case via its
absolute path. For portability, I'd rather include it just using its
name, but it's failing with a "Failed to Open" error and I can't
figure out why. Hopefully someone more familiar with SimpleTest can
point me in the right direction (or point out my stupidity, as the
case may be).

Here are the highlights of my config:

- SimpleTest is installed in a support directory (~/projects/support/
simpletest) so that the framework can be used for multiple apps.

- The application is installed in ~/projects/work/myapp and its tests
are ~/projects/work/myapp/tests

- ~/projects/work/myapp/tests contains both all_tests.php and
my_test_case.php

- My include_path includes ~/projects/support/simpletest and "."

- all_tests.php looks like this:

<?php
require_once ( 'autorun.php' );

class AllTests extends TestSuite {
public function AllTests() {
$this->TestSuite ( 'All tests' );
$this->addFile( 'my_test_case.php' );
}
}
?>

The error:

Warning: SimpleFileLoader::include_once(my_test_case.php)
[function.SimpleFileLoader-include-once]: failed to open stream: No
such file or directory in /home/myusername/projects/support/simpletest/
test_case.php on line 391

Warning: SimpleFileLoader::include_once() [function.include]: Failed
opening 'my_test_case.php' for inclusion (include_path='.:/usr/share/
php:/home/myusername/projects/work/shared-services/classes:/home/
myusername/projects/support/simpletest') in /home/myusername/projects/
support/simpletest/test_case.php on line 391

Warning: file_get_contents(my_test_case.php) [function.file-get-
contents]: failed to open stream: No such file or directory in /home/
myusername/projects/support/simpletest/test_case.php on line 428

Any thoughts would be much appreciated.

Thanks.

Rob
Sep 29 '08 #1
5 3558
Woops. Sorry about the duplicate post. And crap. Just realized
what's probably happening. It's autorun.php that's probably trying to
do the include and that, of course, is failing. How do most folks
structure their environment? Clearly I'm doing it all wrong.

Thanks.
Sep 29 '08 #2
Rob Wilkerson wrote:
Woops. Sorry about the duplicate post. And crap. Just realized
what's probably happening. It's autorun.php that's probably trying to
do the include and that, of course, is failing. How do most folks
structure their environment? Clearly I'm doing it all wrong.

Thanks.
Use a relative path based off of the website root directory, which can
be found in $_SERVER['DOCUMENT_ROOT'].

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 29 '08 #3
On Sep 29, 1:51*pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Use a relative path based off of the website root directory, which can
be found in $_SERVER['DOCUMENT_ROOT'].
Thanks, Jerry. That worked of course:

$this->addFile( $_SERVER['DOCUMENT_ROOT'] . '/my_test_case.php' );

Is this pretty much the "standard" way of including files in a test
suite?
Sep 29 '08 #4
Rob Wilkerson wrote:
On Sep 29, 1:51 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Use a relative path based off of the website root directory, which can
be found in $_SERVER['DOCUMENT_ROOT'].

Thanks, Jerry. That worked of course:

$this->addFile( $_SERVER['DOCUMENT_ROOT'] . '/my_test_case.php' );

Is this pretty much the "standard" way of including files in a test
suite?
It's the way I do it - and a lot of other people I know. It makes
things easier - you can include the file without worrying about what
directory the including file is in.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 29 '08 #5
On Sep 29, 4:02*pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
It's the way I do it - and a lot of other people I know. *It makes
things easier - you can include the file without worrying about what
directory the including file is in.
Fair enough. That works for me. Thanks for your help.
Sep 29 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Phlip | last post by:
C++ newsgroupies: I wrote a parser to solve math expressions like "3.0 ^(4 - 5)", or "3 / 8". Below my sig is test.h, the file containing a tiny test framework. Using it and Test-Driven...
0
by: aloneplayer | last post by:
Hi, All, I wrote a function to share a folder to individual user account with WMI. When I call it : ShareFolder("c:\\test", "Test", "Shared by Riven", 8, Environment.MachineName,...
2
by: Podi | last post by:
Hi, Newbie question about unittest. I am having trouble passing a variable to a test class object. MyCase class will potentially have many test functions. Any help would be much...
3
by: rdps | last post by:
I am a newbie and that says it all about posting a basic doubt. I still hope someone helps me out . I am unit testing some modules. My test module is in diff file than the modules to be tested....
0
by: Henry S. Thompson | last post by:
Thanks to contributions from Microsoft and Sun updating and considerably extending their 2002 contributions, we now have nearly 40,000 tests for W3C XML Schema 1.0 2nd edition. All the tests are...
0
by: Bastien Continsouzas | last post by:
I am trying to set the include path for SimpleTest under Eclipse I have the following config : Eclipse : 3.2.0 PHPEclipse 1.1.8 SimpleTest plugin : 0.2.1 I ran a test I found on the...
2
by: prem | last post by:
Hi, Anybody know if there are any *FREE* ANSI C test suite for C/C++ for Compiler available? Any link/pointers is appreciated /Prem
4
by: oksid | last post by:
Hello, I'm writing a C99 preprocessor and I want to check its compliance with the ISO standard. I would like to know what's the best C99 test suite ? GCC seems to have a large set of test...
3
by: Rob Wilkerson | last post by:
I'm trying to cut my teeth on unit testing with SimpleTest by writing tests for a new set of classes that do not have a web root. The classes I want to test comprise a set of core services used by...
0
by: Rob Wilkerson | last post by:
Hey guys - I have a test suite that's working when I include a test case via its absolute path. For portability, I'd rather include it just using its name, but it's failing with a "Failed to...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.