Discovering unittests

at 2009-06-01 in UnittestsExamples by friebe (0 comments)

In the api documentation of a class, certain tags can be used, such as @see, @param or @return. Not only can they be used but it's actually strongly encouraged (you knew that, though).

To discover unittests by a given class name, the doclet API can be used.

Sourcecode:

<?php 
uses
('text.doclet.Doclet', 'util.cmd.Console');

class UnittestsOf extends Doclet {

public
function start(RootDoc $root) {
while
($this->classes->hasNext()) {
foreach
($this->classes->next()->tags('test') as $test) {
Console::write
($test->class, ' ');
}
}
}
}
?>

To run this doclet, simply call it as follows:
  $ doclet UnittestsOf lang.XPClass

It will output the test class names that ensure lang.XPClass' functionality.



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases
5.8-SERIES

Related

Find related articles by a search for «Discovering».