You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
(14) |
Oct
(22) |
Nov
(21) |
Dec
(7) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(4) |
Feb
(26) |
Mar
(62) |
Apr
(60) |
May
(73) |
Jun
(41) |
Jul
(64) |
Aug
(39) |
Sep
(19) |
Oct
(18) |
Nov
(55) |
Dec
(24) |
| 2005 |
Jan
(35) |
Feb
(122) |
Mar
(130) |
Apr
(62) |
May
(57) |
Jun
(103) |
Jul
(71) |
Aug
(142) |
Sep
(67) |
Oct
(27) |
Nov
(49) |
Dec
(56) |
| 2006 |
Jan
(42) |
Feb
(65) |
Mar
(30) |
Apr
(43) |
May
(13) |
Jun
(25) |
Jul
(5) |
Aug
(14) |
Sep
(18) |
Oct
(55) |
Nov
(126) |
Dec
(82) |
| 2007 |
Jan
(83) |
Feb
(83) |
Mar
(173) |
Apr
(30) |
May
(64) |
Jun
(156) |
Jul
(50) |
Aug
(29) |
Sep
(25) |
Oct
(26) |
Nov
(51) |
Dec
(9) |
| 2008 |
Jan
(36) |
Feb
(71) |
Mar
(93) |
Apr
(123) |
May
(34) |
Jun
(14) |
Jul
(21) |
Aug
(26) |
Sep
(49) |
Oct
(38) |
Nov
(19) |
Dec
(46) |
| 2009 |
Jan
(18) |
Feb
(16) |
Mar
(46) |
Apr
(4) |
May
(18) |
Jun
(9) |
Jul
(11) |
Aug
(4) |
Sep
(31) |
Oct
(19) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(15) |
Feb
(9) |
Mar
|
Apr
(20) |
May
(5) |
Jun
(8) |
Jul
(2) |
Aug
(9) |
Sep
(6) |
Oct
(21) |
Nov
(20) |
Dec
(11) |
| 2011 |
Jan
(11) |
Feb
(5) |
Mar
(6) |
Apr
(1) |
May
(12) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(4) |
Oct
(3) |
Nov
(3) |
Dec
(5) |
| 2012 |
Jan
(28) |
Feb
(7) |
Mar
(3) |
Apr
|
May
(5) |
Jun
(6) |
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(4) |
Nov
(5) |
Dec
(4) |
| 2013 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(7) |
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2016 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
(3) |
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Mark D. <mar...@hp...> - 2008-08-22 19:35:59
|
Marcus Baker wrote:
> Hi...
>
> Mark Donohoe wrote:
>> Thanks for any insight you can give.
>>
>
> I don't tend to need this. Do you have a concrete example? I can more
> clearly say what I do if I have something I can give a code snippet for.
>
> yours, Marcus
Marcus, here is my latest attempt. I have other examples I give next week.
Below is an attempt to create a run script that will run 1 test (useful for
working on the test and avoids having to edit the run file).
Why does this fail like this? To me what gets passed to the test should be
exactly the same (the var gets expanded into the same string).
markd@snape: ./rat.php UnitTests/testparseBrowseMenus.php
RAT: prarameters are:./rat.php
UnitTests/testparseBrowseMenus.php
Catchable fatal error: Object of class TestSuite could not be converted to
string in /usr/local/simpletest/test_case.php on line 391
markd@snape: ./rat.php UnitTests/testparseBrowseMenus.php
If I adjust the requires in the test and just have
UnitTests/testparseBrowseMenus.php as the test to run it works.
Here is the code:
#!/usr/bin/php
<?php
/* simpletest includes */
require_once '/usr/local/simpletest/unit_tester.php';
require_once '/usr/local/simpletest/web_tester.php';
require_once '/usr/local/simpletest/reporter.php';
require_once ('fossologyWebTestCase.php');
require_once ('TestEnvironment.php');
list ($me, $test) = $argv;
print "RAT: prarameters are:$me\n$test\n";
$test = & new TestSuite("Run Fossology test $test");
/* this line works */
$test->addTestFile('UnitTests/testparseBrowseMenus.php');
/* this line fails */
//$test->addTestFile($test);
if (TextReporter :: inCli())
{
exit ($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
?>
Thanks for your time and help.
--
Mark Donohoe
OSLO/OSTT, Cupertino CA.
fossology.org
|
|
From: Noel D. <ma...@mc...> - 2008-08-22 18:39:27
|
On Fri, 22 Aug 2008 06:57:59 +0300 "Kyohere Luke" <pr...@gm...> wrote: > I'm trying to test Class_A::Method_B(..). Method_B internally calls > Class_C::Method_D() - which takes a long time, and is accessed from > the global/autoload mechanism of the application. I'd like to skip > this call, since it's irrelevant to my tests. If class_c->method_d() is part of the logic of class_A->method_B() then it is relevant to the test. Mocking is often a good way to test object interactions but you could also use the real object. There are pros and cons to both. I usually favour mocks myself. Actually, mocks are more about design than testing (although that too). If you were coding test-first, you'd have discovered a need for class_C while writing a test for class_A, mocked it out, and then come back to implement it later. I can't recommend this way of working strongly enough. For one thing, you wouldn't be wondering how to test the class you've just written: it would already be fully-tested ;) > Aside from re-designing my class/method to read in Class_C as one of > it's arguments, or else creating a dummy Class_C, and loading it > before the real one is loaded, is there a way to achieve this with > Mocks? You probably should pass it in (either directly or via some kind of registry/container, as suggested above, and probably in that order of preference). Very often that will be the best choice - but it isn't *always* the best choice. If class_A should be responsible for instantiating class_C, the other thing you can do is to use a partial mock: (1) in class_A, refactor object instantiation into a factory method (2) knock the method out with a partial mock of class_A (3) set the method to return a reference to a mock class_C This is explained in the simplestest docs but I'll post some code if you're not sure how it works. > Secondly, is there a way to prevent the class I'm trying to test from > calling such mundane php functions like file_exists(), etc? Because > in such a case, I have to design my test to create/delete files from > the file system and so on. That's fine. Have a look at http://aperiplus.sourceforge.net/FileSystemTestCase.php. I've written some extensions for SimpleTest, and this is what I use for filesystem tests. It's not really supported and is liable to change suddenly if I think of something better but it might give you a few ideas. Pinch anything you like the look of. The expectation classes will work in a standard UnitTestCase. http://aperiplus.svn.sourceforge.net/viewvc/aperiplus/lib/simpletest/ Alternatively you could refactor the file_exists() call into a method and kill it in a partial mock, similar to above. Personally, I'd just write/unlink the files. In general, when you hit an application boundary I think that you should use the real resource. Noel |
|
From: Margy L. Y. <Ma...@uu...> - 2008-08-22 16:29:15
|
I've got it! I was looping through an array of fields and values,
setting various fields to various values and checking the database to
make sure that the correct value was stored. However, for checkboxes,
the set value ('on') isn't the same as the saved value (-1), so my test
failed. I just need to special-case checkboxes.
Thanks for your quick offer of help! I love SimpleTest.
Margy Levine Young, Systems Analyst
UUA Information Technology Staff Group
my...@uu..., 802-989-3371
"We need not think alike to love alike." -- David Ferenc
-----Original Message-----
From: sim...@li...
[mailto:sim...@li...] On Behalf Of
Marcus Baker
Sent: Friday, August 22, 2008 9:26 AM
To: Help, advice, bugs and workarounds
Subject: Re: [Simpletest-support] Setting a checkbox
Hi...
Margy Levine Young wrote:
> Is 'on' not the right value to use? I've tried true, 1, -1, 'checked',
> 'selected', you name it!
'on' or true should have worked. Can you post the bit of HTML it was
trying to read, and the test? I can debug from there.
> Margy Levine Young, Systems Analyst
yours, Marcus
------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Simpletest-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simpletest-support
|
|
From: Marcus B. <ma...@wo...> - 2008-08-22 13:17:47
|
Hi... Margy Levine Young wrote: > Is 'on' not the right value to use? I've tried true, 1, -1, 'checked', > 'selected', you name it! 'on' or true should have worked. Can you post the bit of HTML it was trying to read, and the test? I can debug from there. > Margy Levine Young, Systems Analyst yours, Marcus |
|
From: Margy L. Y. <Ma...@uu...> - 2008-08-22 12:38:36
|
I'm having trouble setting a checkbox -- it ought to be simple, but I
don't seem to be able to get the value right.
The form contains this field:
<input type="checkbox"
name="directory" title="Include me in congregation directory"
checked="checked" id="field_directory" />
The SimpleTest test contains this:
$this->setFieldByName('directory', 'on');
But the test failed to check the checkbox.
Is 'on' not the right value to use? I've tried true, 1, -1, 'checked',
'selected', you name it!
Thanks in advance for any help!
Margy Levine Young, Systems Analyst
UUA Information Technology Staff Group
my...@uu..., 802-989-3371
"We need not think alike to love alike." -- David Ferenc
|
|
From: Chris C. <ch...@w3...> - 2008-08-22 04:30:22
|
Hi, It's not possible to override PHP's internal functions (or any global functions) except perhaps with the help of RunKit. In terms of providing a mock version of Class_C, I'd suggest using a little dependency lookup as a the path of least resistance if you need to retrofit this without too much modification. A registry would be the simplest way to achieve this. Cheers, Chris Kyohere Luke wrote: > Hi, > > here's the scenario: > > I'm trying to test Class_A::Method_B(..). Method_B internally calls > Class_C::Method_D() - which takes a long time, and is accessed from the > global/autoload mechanism of the application. I'd like to skip this call, > since it's irrelevant to my tests. > > Aside from re-designing my class/method to read in Class_C as one of it's > arguments, or else creating a dummy Class_C, and loading it before the real > one is loaded, is there a way to achieve this with Mocks? > > Secondly, is there a way to prevent the class I'm trying to test from > calling such mundane php functions like file_exists(), etc? Because in such > a case, I have to design my test to create/delete files from the file system > and so on. > > Thanks! > > Luke > > |
|
From: Kyohere L. <pr...@gm...> - 2008-08-22 03:58:00
|
Hi, here's the scenario: I'm trying to test Class_A::Method_B(..). Method_B internally calls Class_C::Method_D() - which takes a long time, and is accessed from the global/autoload mechanism of the application. I'd like to skip this call, since it's irrelevant to my tests. Aside from re-designing my class/method to read in Class_C as one of it's arguments, or else creating a dummy Class_C, and loading it before the real one is loaded, is there a way to achieve this with Mocks? Secondly, is there a way to prevent the class I'm trying to test from calling such mundane php functions like file_exists(), etc? Because in such a case, I have to design my test to create/delete files from the file system and so on. Thanks! Luke -- -- Luke Kyohere -- /dev/null |
|
From: Kyohere L. <pr...@gm...> - 2008-08-20 20:23:25
|
Nice, let me try that.
On Wed, Aug 20, 2008 at 8:17 PM, Marcus Baker <ma...@wo...>wrote:
> Hi...
>
> Kyohere Luke wrote:
> > I want to check that a certain function throws an exception of a certain
> > kind. How do I do this?
>
> $this->expectException('TheExceptionClass');
> // The code that throws...
>
> >
> > Thanks.
> >
> > Luke
>
> yours, Marcus
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Simpletest-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simpletest-support
>
--
-- Luke Kyohere
-- /dev/null
|
|
From: Kyohere L. <pr...@gm...> - 2008-08-20 20:22:42
|
Great, thanks ...
On Wed, Aug 20, 2008 at 7:47 PM, Jason Sweat <jsw...@ya...> wrote:
>
>
> ----- Original Message ----
> From: Kyohere Luke <pr...@gm...>
> To: "Help, advice, bugs and workarounds" <
> sim...@li...>
> Sent: Wednesday, August 20, 2008 10:48:15 AM
> Subject: [Simpletest-support] Mocks: How to use regular expressions to test
> the arguments with expectOnce()
>
>
> $form->expectOnce('addElement', array('html', '*ERROR 123*');
>
> How would I do this?
>
>
> Hi Luke,
> Try:
>
> $form->expectOnce('addElement',
> array('html', new WantedPatternExpectation('/ERROR 123/'));
>
> Regards,
> Jason
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Simpletest-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simpletest-support
>
--
-- Luke Kyohere
-- /dev/null
|
|
From: Marcus B. <ma...@wo...> - 2008-08-20 17:09:48
|
Hi...
Kyohere Luke wrote:
> I want to check that a certain function throws an exception of a certain
> kind. How do I do this?
$this->expectException('TheExceptionClass');
// The code that throws...
>
> Thanks.
>
> Luke
yours, Marcus
|
|
From: Jason S. <jsw...@ya...> - 2008-08-20 17:01:51
|
----- Original Message ----
From: Kyohere Luke <pr...@gm...>
To: "Help, advice, bugs and workarounds" <sim...@li...>
Sent: Wednesday, August 20, 2008 10:54:35 AM
Subject: [Simpletest-support] How to expect an exception
I want to check that a certain function throws an exception of a certain
kind. How do I do this?
Hi Luke,
Try:
$this->assertIsA(your_function(), 'expectedType');
Regards,
Jason
|
|
From: Jason S. <jsw...@ya...> - 2008-08-20 16:47:57
|
----- Original Message ----
From: Kyohere Luke <pr...@gm...>
To: "Help, advice, bugs and workarounds" <sim...@li...>
Sent: Wednesday, August 20, 2008 10:48:15 AM
Subject: [Simpletest-support] Mocks: How to use regular expressions to test the arguments with expectOnce()
$form->expectOnce('addElement', array('html', '*ERROR 123*');
How would I do this?
Hi Luke,
Try:
$form->expectOnce('addElement',
array('html', new WantedPatternExpectation('/ERROR 123/'));
Regards,
Jason
|
|
From: Kyohere L. <pr...@gm...> - 2008-08-20 15:54:38
|
I want to check that a certain function throws an exception of a certain kind. How do I do this? Thanks. Luke |
|
From: Kyohere L. <pr...@gm...> - 2008-08-20 15:48:17
|
I would like to use expectOnce(...) but one of the arguments will be a long
string, which will include an Error Code that I would like to test for.
e.g. if the function call I want to set for would be something like
$form->addElement('html', '<font color="red"><b>ERROR CODE: ERROR
MESSAGE</b></font>');
where ERROR CODE is set by the calling function.
How do I test that ERROR CODE is equal to 123, for example. I've already
created a Mock of the $form object, and want to do something like
$form->expectOnce('addElement', array('html', '*ERROR 123*');
How would I do this?
Thanks.
Luke
|
|
From: Noel D. <ma...@mc...> - 2008-08-19 13:39:28
|
On Mon, 18 Aug 2008 22:17:40 +0100 Marcus Baker <ma...@wo...> wrote: > Once I'm back on the SimpleTest code base again, we'll make this > system more automatic. I've recently been trying out an idea for test case decorators. See "Decorating Test Cases" in http://aperiplus.sourceforge.net/AperiTestCase.php. Feel free to pinch any good ideas or alternatively avoid repeating my bad ones. __call() forwards messages to a decorator stack and hence decorator methods magically appear as test case methods. Aggregated decorator objects can be mixed 'n matched in any combinations. I think some built-in sanity checks will be necessary to make this usable. For example, an exception is thrown if two different decorators both try to add a foo() to the test case. This has been working successfully but I haven't been using it for long and may not have discovered all the problems. Noel |
|
From: Mark D. <mar...@hp...> - 2008-08-18 23:05:46
|
Marcus Baker wrote:
> Hi...
>
> Mark Donohoe wrote:
>> I also tried to have the above classes extend fossologyWebTestCase instead of
>> WebTestCase, but still get the same failure?
>> ...
>
> This is going to nearly impossible to sort out via e-mail. Can you send
> me an example failing test case, with as small amount of code as
> necessary to duplicate your problem? I can debug it quickly and easily
> if I can play with real code. Most of what you describe *should* work fine.
>
>> What am I missing, how do I do this? Thanks for your time and help.
Marcus,
Thanks for your time... I thought it should work, I was starting to feel really
dumb! Here is the code I used, I actually tried this when I tried refactoring,
since that attempt failed I went to a simple example to see if that would work
when it didn't I posted.
Below is the code, it's as small as I could make it and represent what I was
trying to do. I need to read the second part of your message to see how that
will help, as that might also help with my testing.
1. fossWebTestCase.php
<?php
if (!defined('SIMPLE_TEST'))
define('SIMPLE_TEST', '/usr/local/simpletest/');
/* simpletest includes */
require_once SIMPLE_TEST . 'unit_tester.php';
require_once SIMPLE_TEST . 'reporter.php';
require_once SIMPLE_TEST . 'web_tester.php';
class fossWebTestCase extends WebTestCase
{
public $mybrowser;
public $debug;
public function funcTrue() { return(TRUE); }
public function funcFalse() { return(FALSE); }
public function someTest()
{
print "starting someTest\n";
if($this->debug)
{
print "Checking /tmp\n";
}
$this->assertTrue(is_dir('/tmp'));
$this->assertTrue($this->get('http://www.hp.com'));
}
}
?>
2. the run script: 'runexp.php
#!/usr/bin/php
<?php
require_once('/usr/local/simpletest/web_tester.php');
require_once '/usr/local/simpletest/reporter.php';
require_once ('fossWebTestCase.php');
/**
* stub to run lib tests
* Created on Aug 18, 2008
*/
$test = &new TestSuite('Experiment for test libraries');
$test->addFile('exp1.php');
$test->addFile('exp2.php');
$test->addTestFile('exfoss.php');
if (TextReporter::inCli())
{
exit ($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
?>
The Test: exfoss.php
<?php
require_once('fossWebTestCase.php');
class expfoss extends fossWebTestCase
{
function testexpfoss()
{
print "running expfoss\n";
print "using sometest from fossWebTestCase\n";
$this->someTest();
print "trying to use exp2::doaTest\n";
$this->doaTest();
print "trying to use exp1::guess\n";
assertTrue($this->guess(7)); // should pass
assertTrue($this->guess(10)); // should fail
}
}
?>
Test libraries: (well that's what I'm currently calling them)....
1. exp1.php
<?php
class exp1tester extends fossWebTestCase
{
public $answer = 7;
function guessTest($guess)
{
print "guessTest is running\n";
$this->assertTrue($this->get('http://fossology.org/'));
$this->assertText('Fossology Mission');
if($answer == $guess){
print "You guessed the answer! it is $answer\n";
return TRUE;
}
else {
print "Sorry! Incorrect guess, try again\n";
return FALSE;
}
}
}
Second lib file: exp2.php
<?php
require_once('fossWebTestCase.php');
class exp2tester extends fossWebTestCase
{
function doaTest()
{
print "doaTest is running\n";
$this->assertTrue($this->get('http://www.lastcraft.com/'));
$this->assertText('Why the last craft');
}
}
?>
Output:
./runexp.php
Experiment for test libraries
running expfoss
using sometest from fossWebTestCase
starting someTest
trying to use exp2::doaTest
Fatal error: Call to undefined method expfoss::doaTest() in
/home/markd/Src/fossology/tests/testClasses/exfoss.php on line 17
markd@snape:
The line number of the failure is incorrect, I chopped some more comments to
make the code smaller.
This being run on a debian etch system, using PHP version PHP 5.2.0-8+etch11
(cli) and using simpletest_1.0.1.
BTW, I was serious about helping with the documents. My job will allow me some
time to do so and I can devote some of my personal time as well. I really like
your project and want to help make it even easier to use. I have notes about
the current docs. Should I just file a defect report via Source Forge or post
them somewhere?
Thanks again for your time.
--
Mark Donohoe
OSLO/OSTT, Cupertino CA.
fossology.org
|
|
From: Marcus B. <ma...@wo...> - 2008-08-18 21:20:17
|
Hi... kailash vyas wrote: > Please advise on what the problem might be. I need to test this myself, and work pressure means I haven't yet had a chance. Do you have a small test case and prepend that you know fails. I could then just run it immediately, which means I could have a crack at it during a lunch break. > > Thanks, > Kailash Vyas yours, Marcus |
|
From: Marcus B. <ma...@wo...> - 2008-08-18 21:17:49
|
Hi... Mark Donohoe wrote: > Thanks for any insight you can give. > I don't tend to need this. Do you have a concrete example? I can more clearly say what I do if I have something I can give a code snippet for. yours, Marcus |
|
From: Marcus B. <ma...@wo...> - 2008-08-18 21:16:26
|
Hi...
Mark Donohoe wrote:
> I also tried to have the above classes extend fossologyWebTestCase instead of
> WebTestCase, but still get the same failure?
> ...
This is going to nearly impossible to sort out via e-mail. Can you send
me an example failing test case, with as small amount of code as
necessary to duplicate your problem? I can debug it quickly and easily
if I can play with real code. Most of what you describe *should* work fine.
> What am I missing, how do I do this? Thanks for your time and help.
>
The project wide test case that Jason suggests is really for project
wide settings. I tend to use a different technique for composing test
behaviours.
Take a mail test helper...
class MailFixture {
function __construct($test) {
$this->test = $test
}
function setUp() { ... }
function tearDown() { ... }
function assertHas($email, $substring, $th = 1) { ... }
...
}
class TestingSomeMailStuff extends UnitTestCase {
function setUp() {
$this->mail()->setUp();
}
function tearDown() {
$this->mail()->tearDown();
}
function testMailWasSentOnNewPasswordRequest() {
$accounts = new MockAccounts();
$accounts->setReturnValue('getPassword', 'secret', array('me'));
$request = new Request(array('email' => 'me...@he...'
'username' => 'me'));
$controller = new ReminderController($request, $accounts);
$this->mail()->assertBody('me...@he...', ' secret ');
}
// This can go into your project wide test cases.
function mail() {
return new MailFixture($this);
}
}
Actually, in a real unit test I'd mock the Mailer as well, but bear with me.
The MailHelper (imported with require_once(dirname(__FILE__) ...)) can
be used anywhere. As it's only created when needed, and has no state, we
can move the factory method into your project wide test cases. This
makes the tests pretty clean, just adding a small function chain when
using these facilities.
Once I'm back on the SimpleTest code base again, we'll make this system
more automatic.
yours, Marcus
|
|
From: Mark D. <mar...@hp...> - 2008-08-18 20:29:07
|
Hello,
Have been using ST for about 2-3 months now. Like it lot, well except for the
documentation... a great start but then.....I'd like to help fix some of that...
Here is the problem of the week. I'm sorta new to OO as well, so it could be
that and not ST.
I'm trying to use Jason's suggestion to extend WebTestCase with my own project
specific class. So far so good. But now my fossologyWebTestCase class is
getting big with more methods than I want. I tried to refactor but could not
get things to work that way....
Specifics I tried:
class fossologyWebTestCase extends WebTestCase {
function uploadAFile(....) { ... }
function browseMiniMenu(...) { ....}
etc....
}
What I would like to do is create a number of 'utility' test classes that can be
used by the basic unit tests as well as for other higher level functional and
stress testing.
I tried to factor our things like uploads to an upload class, browse to a browse
class etc...
I tried
class uploadsTests extends WebTestCase {
function uploadAFile(....) { ... }
....
}
class browseMenusTests extends WebTestCase {
function browseMiniMenu(...) { ....}
....
}
Then in my runner script:
test = &new TestSuite('Experiment for test libraries');
$test->addFile('testClasses/uploads.php');
$test->addFile('testClasses/browseMenus.php');
$test->addTestFile('testClasses/exfoss.php');
if (TextReporter::inCli())
{
exit ($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
exfoss.php is a test that tries to use tehe functions uploadAFile and
browseMiniMenu, but always gets:
Fatal error: Call to undefined method expfoss::uploadAFile() in
/home/markd/Src/fossology/tests/testClasses/exfoss.php on line xx
I also tried using autorun and extending TestSuite like the example in the
web_tester docs. Same result.
I also tried to have the above classes extend fossologyWebTestCase instead of
WebTestCase, but still get the same failure?
I also tried having my main fossologyWebTestCase require_once uploads.php and
browseMenu.php and still got the failure above. Tried it twice, once as a
'extends WebTestCase' and once with extends fossologyWebTestCase and still got
undefined method error.
All of my 'Tests' extend fossologyWebTestCase. The above functions
(uploadAFile) are also tests in that they use assertions and the like to ensure
what they are doing is correct. I want methods like uploadAFile to be
accessible by any test that needs it, but would like them to be in their own
file at least so that everything doesn't have to be in one class.
What am I missing, how do I do this? Thanks for your time and help.
--
Mark Donohoe
OSLO/OSTT, Cupertino CA.
fossology.org
|
|
From: <mar...@tu...> - 2008-08-01 07:24:54
|
Thank you very much, In fact I have already implemented a simpletest test calling phpunit selenium, and it works fine, but I wondered if there was a way to do without calling phpunit, as I saw a selenium extension in simpletest. but since it works fine, I think I'll let it like that. thank you, Dagfinn Reiersøl <da...@re...> Sent by: sim...@li... 01/08/2008 08:38 Please respond to "Help, advice, bugs and workarounds" <sim...@li...> To "Help, advice, bugs and workarounds" <sim...@li...> cc Subject Re: [Simpletest-support] selenium extension mar...@tu... wrote: > Hi, > > I've just seen that in its svn version, simpletest has selenium > extensions. > Is there a documentation or a tutorial for using it ? I didn't find it yet > :-( > I wrote a blog post about it last year: http://www.reiersol.com/blog/1_php_in_action/archive/10_using_selenium_with_simpletest.html ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Simpletest-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simpletest-support |
|
From: Dagfinn R. <da...@re...> - 2008-08-01 06:40:13
|
mar...@tu... wrote: > Hi, > > I've just seen that in its svn version, simpletest has selenium > extensions. > Is there a documentation or a tutorial for using it ? I didn't find it yet > :-( > I wrote a blog post about it last year: http://www.reiersol.com/blog/1_php_in_action/archive/10_using_selenium_with_simpletest.html |
|
From: Marcus B. <ma...@wo...> - 2008-07-31 18:27:15
|
Hi... Mark Donohoe wrote: > http://www.sitepoint.com/forums/showthread.php?t=562695 OK, I've added a reply there. yours, Marcus |
|
From: <mar...@tu...> - 2008-07-31 12:58:57
|
Hi,
I've just seen that in its svn version, simpletest has selenium
extensions.
Is there a documentation or a tutorial for using it ? I didn't find it yet
:-(
I tryed like that:
class SeleniumTest_Start extends SeleniumTestCase
{
private $urlBase;
function SeleniumTest_Start($name="Start")
{
try {
$this->verificationErrors = array();
$this->host = $_SERVER['HTTP_HOST'];
$this->urlBase = "http://".$this
->host.HttpRequest::getPathUrl();
$this->setBrowser("*chrome");
$this->setBrowserUrl($this->urlBase);
$this->start();
$this->open($this->urlBase."/index.php");
}
catch (RuntimeException $re){
$this->stop();
}
}
}
which is nearly the code I used with phpunit extension
but get as errors:
Warning: call_user_func_array() [function.call-user-func-array]: First
argument is expected to be a valid callback, 'Array' was given in
\simpletest\extensions\selenium.php on line 73
Warning: call_user_func_array() [function.call-user-func-array]: First
argument is expected to be a valid callback, 'Array' was given in
\simpletest\extensions\selenium.php on line 73
Warning: call_user_func_array() [function.call-user-func-array]: First
argument is expected to be a valid callback, 'Array' was given in
\simpletest\extensions\selenium.php on line 73
Warning: call_user_func_array() [function.call-user-func-array]: First
argument is expected to be a valid callback, 'Array' was given in
\simpletest\extensions\selenium.php on line 73
SeleniumTest_Start
test_1_start_1_langue_fr parsed
Exception: test_1_start_1_langue_fr -> Unexpected exception of type
[Exception] with message [this code currently requires the curl extension]
in [\simpletest\extensions\selenium\remote-control.php line 107]
Thank you very much,
marilore
|
|
From: Elijah I. <tm...@gm...> - 2008-07-31 11:25:06
|
Hey guys, I have just released version 0.6 the ajax test runner. It now includes some of the tests taken from the test directory in simpletest as "examples" and also a PHPUnit example. There have been a few bug fixes and functionality improvements since 0.5. You can find more information here: http://www.blerby.com/project/testrunner/documentation/ Feel free to have a look and give me feedback! Thanks -- Elijah |