473,662 Members | 2,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ph p

- 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.p hp' );
}
}
?>

The error:

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

Warning: SimpleFileLoade r::include_once () [function.includ e]: Failed
opening 'my_test_case.p hp' 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_conten ts(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 3585
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*******@attgl obal.net
=============== ===

Sep 29 '08 #3
On Sep 29, 1:51*pm, Jerry Stuckle <jstuck...@attg lobal.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.ph p' );

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...@attg lobal.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.ph p' );

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*******@attgl obal.net
=============== ===

Sep 29 '08 #5
On Sep 29, 4:02*pm, Jerry Stuckle <jstuck...@attg lobal.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
1767
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 Development, I produced the test suite and the parser, appearing in parallel posts. -- Phlip http://industrialxp.org/community/bin/view/Main/TestFirstUserInterfaces
0
2585
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, "Administrator"); The folder will be shared, but nobody has permission to access it. (The share permissions list of this folder is empty) Could you help me?
2
3849
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 appreciated. Thanks,
3
1588
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. My code is something like this : <PRE> class xyz(unittest.TestCase): def testAbc():
0
1223
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 now accompanied by metadata in the form set out in the XML Schema Test Suite Framework . The community owes a big "Thank You" to NIST, Sun and Microsoft for contributing their extensive test collections -- we welcome further contributions!
0
1877
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 SimpleTest plugin page and it worked fine http://simpletest.org/en/extension_eclipse.html
2
2029
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
2615
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 files. Is there something better available ? Thanks in advance,
3
1600
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 web applications. Without a virtual host, is there any way to use the web interface of SimpleTest? I think that would help me visualize what I'm going more than using the command line option. I tried faking it by using...
0
534
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 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:
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8764
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.