Contenu connexe
Plus de makoto tsuyuki (10)
Testman
- 2. Success
Fail
rhacoのキャラクターを書いてくれる人を募集するために書いたダサいカエルの絵が会社のJenkinsで
使われています。rhacoのテストはxUnit形式のxmlを出力していなくてjenkinsが使えない。同僚は仕
方なくphpUnitを使おうとしたようですが…
- 4. • curl -L -O
https://github.com/downloads/tokushima/
testman/testman.php
http://localhost/testman.php/web/index.php
Testmanはファイル一つ。ブラウザで表示できる。使い方のドキュメントも含んでいる。
- 7. test client
• https://github.com/tokushima/
testman/blob/master/example/test/
entry/top.php
<?php
eq(1,1);
$b = b();
$b->do_get(test_map_url('top','HOGE','AAA'));
eq('TOP_HOGEAAA',$b->body());
URLの設定から逆引きして決定したURLに対してブラウザの振りをしたクライアントでのテストもでき
る。
- 8. doctest
<?php
class Sample{
public function abc($str){
return '('.$str.')';
/∗∗∗
∗ $self = new self();
∗ eq("(hoge)",$self->abc("hoge"));
∗/
/∗∗∗
# fuga
$self = new self();
eq("(fuga)",$self->abc("fuga"));
∗/
}
static public function def($str){
return '('.$str.')';
/∗∗∗
eq("(hoge)",self::def("hoge"));
∗/
}
/∗∗∗
eq("(hoge)",self::def("hoge"));
$self = new self();
eq("(fuga)",$self->abc("fuga"));
∗/
/∗∗∗
# __setup__
eq(true,true);
∗/
/∗∗∗
# __teardown__
eq(true,true);
∗/
}
Pythonistaにはおなじみのdoctest。doctestなのにsetupとteardownがある。