473,396 Members | 2,109 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,396 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 3563
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.