#### Archived

This topic is now archived and is closed to further replies.

# Web SimpleTest help

## Recommended Posts

Hi, I want to use SimpleTest framework (unit test library) to test if a web page has the text set in the title tag, but I am using localhost, so I think that's why it doesn't run, does anyone know how to configure php.ini (I think it's security issue)

here is script:

=========

<?php
require_once('simpletest/autorun.php');
require_once('simpletest/web_tester.php');

class TestOfMyWebPage extends WebTestCase {

function testMyPageIndex() {//THIS function just goes to the page then asserts if title tag has "My Page:Home" text set
$this->get("C:/xampp/htdocs/projectMyWebsite/MyPageIndex.html");$this->assertTitle("My Page:Home");//test if the page contains this page content
}
}
?>


Any help much appreciated!

##### Share on other sites

What leads you to security and php.ini? Are you receiving any errors?

##### Share on other sites

I think he may be missing a web server?

$this->get("C:/xampp/htdocs/projectMyWebsite/MyPageIndex.html"); Hmm.. I don't think so. Though how are you trying to run this exactly mx760? #### Share this post ##### Link to post ##### Share on other sites I use XAMPP (so I have Apache installed), but when I run this script from cmd, I get this message: Equal expectation fails at character 0 with [My Page:Home] and [bad requrest!] at [C:\xampp\htdocs\path\way\to\this\script for line 9] line 9 is my assertion:$this->assertTitle b/c I am pretty sure assertTitle checks  the <title> tag

If not too much trouble, if anyone just install simpletest and then copy my code but make up a simple webpage to run off your localhost (make sure put the simpletest dir in C:\xampp\htdocs along with your webpage of course) and test quickly for me what you get, that be great.

Here is link on Web SimpleTest lesson:

Any help much appreciated.

##### Share on other sites

What do you see if you go to "http://localhost" or more importantly "http://localhost/projectMyWebsite/MyPageIndex.html" in your browser?

##### Share on other sites

My website, I know it is not the localhost issue (as I said, XAMPP has Apache,MySQL and PHP all prebundled), and it is not SimpleTest b/c I have tried the same test on internet-based webpages like cnn.com etc, so that's why I figure it must be php.ini, if possible (it only takes 5 minutes or so), just install XAMPP or whatever used for localhost make a simple webpage that you store to C:\xampp\htdocs and install SimpleTest (put in C:\xampp\htdocs) and make make a new script (just copy my code but change info according to your webpage and directory) and put SimpleTest, your webpage, SimpleTest script for your webpage in htdocs and just run it.

Sorry to be longwinded.

Any help much appreciated!

##### Share on other sites

Hi, please can someone just help out! The installation is simple (download XAMPP, download SimpleTest, make a simple webpage, make a simple SimpleTest script and put the SimpleTest script, your webpage to test, SimpleTest dir inside htdocs!)

Any help much appreciated!

##### Share on other sites

No one is going to install some framework just to test your code. You might want to actually describe the issue your having.

##### Share on other sites

Hi, this the error I get:

Equal expectation fails at character 0 with [My Page:Home] and [bad requrest!] at [C:\xampp\htdocs\path\way\to\this\script for line 9]

$this->assertText('Hello world!'); } } ?>  Any help much appreciated! #### Share this post ##### Link to post ##### Share on other sites Iv'e not used simpletest, but I would assume that get() expects a url. #### Share this post ##### Link to post ##### Share on other sites No, that's not it, b/c when I try the following assertion on the get:$this->assertTrue($this->get("localhost/proj_ath/xmlShredderIndex.php")); it returns: PASS 1, FAIL 1 (the get passed, the assertText fails, I know b/c I commented out the assertText and I still get PASS 1) in the command line (this is just SimpleTest output) Any help much appreciated! #### Share this post ##### Link to post ##### Share on other sites I beg anyone to please help a new php programmer out! I even tried contacting the creater of SimpleTest, he doesn't respond. Any help much appreciated! #### Share this post ##### Link to post ##### Share on other sites :'( Please, please why won't people help out? I just want to get it to check if the desired webpage has the content via assertText, but it doesn' work when I run it. At first I thought it was local host but I tested that via:$this->assertTrue(\$this->get("localhost/projidr/Whatever.php"))

I beg, I beg someone to help me!!

Any help much appreciated!

##### Share on other sites

Either you haven't provided enough information for anyone to be able to help, no one has enough knowledge with simpleTest or your desperation is turning people off wanting to assist you.

×

• #### Activity

• Chat
×
• Create New...