Hi,
> > today I started to write a "test environment" for midgard.
>
> Sounds great -- though I cannot see what exactly you are
> testing, so there is not detailed feedback from my side. With
> testing installations themselves I do not have any experience.
You're right. It was my intention not to show my code because it is still
ugly :)
I just want to show how a "midgard test environment" could look like.
The structure of the testing code:
"MgdTest"-Topic
|
+-- "self-test"-article (test the Test-Class)
|
+-- "run"-Topic (main Test-Topic)
|
+-- "article"-Topic (test article code)
|
+-- "get"-Topic (test mgd_get_article_*)
|
+-- "basic"-Article (look below)
article/get/basic ($article->content):
$this->plan(14);
$this->nok(mgd_get_article(0)); // should fail
$t = mgd_get_topic_by_name($this->topic, "test");
$this->ok(is_object($t));
$a = mgd_get_article_by_name($t->id, "article_name");
$a = mgd_get_article($a->id);
$this->ok(is_object($a));
$this->ok(strtolower(get_class($a)) == 'midgardarticle');
$this->ok($a->topic == $t->id);
$this->ok($a->up == 0);
$this->ok($a->name == 'article_name');
$this->ok($a->title == 'article title');
$this->ok(trim($a->abstract) == 'abstract');
$this->ok(trim($a->content) == 'content');
$this->ok($a->type == 0);
$this->ok($a->extra1 == 'e1');
$this->ok($a->extra2 == 'e2');
$this->ok($a->extra3 == 'e3');
This code should test the mgd_get_article(<int>) function.
$this is the MgdTest-Class.
$this->plan(<int>) - plan <int> tests
$this->ok(<bool>) - should pass
$this->assert(<bool>) - synonym for 'ok'
$this->nok(<bool>) - should fail
$this->skip(<bool>) - skip test
(stolen from CPAN's Test::Simple)
I hope this structure is flexible enough, so you could write your
own tests easily.
Comments?
Regards
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]