472,378 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 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 3402
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: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.