2006年05月27日
Test::Unitのサンプル
- ikepon
- 2006年05月27日
- コメントする
- トラックバック (1)
- カテゴリー:Perl
Test::Unitの説明します。
使用するにはTest::Unit::Proceduralをuseします。
use Test::Unit::Procedural;
次のファイルをsapmle.plという名前で保存します。
use Test::Unit::Procedural;
#テスト対象
sub hello {
return "hello"
}
#テスト(成功)
sub test_success {
my $str = hello();
assert($str eq "hello", "test_success失敗です。");
}
#テスト(失敗)
sub test_failuer {
my $str = hello();
assert($str eq "test", "test_failuer失敗です。");
}
sub set_up {
print "set_up called\n";
}
sub tear_down {
print "tear_down called\n";
}
#テストの実行
create_suite();
run_suite();
実行結果は、次の様になります。
> perl sample.pl .set_up called tear_down called .set_up called tear_down called F Time: 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU) !!!FAILURES!!! Test Results: Run: 2, Failures: 1, Errors: 0 There was 1 failure: 1) /usr/local/lib/perl5/site_perl/5.8.6/Class/Inner.pm:116 - test_failuer(Class::Inner::__A1) test_failuer失敗です。 Test was not successful.
2006年05月その他のエントリー
2006年05月27日
Test::Unitのインストール(Test::Unit)(5)
Test::Unitのインストール(Test::Unit)(4)
Test::Unitのインストール(Test::Unit)(3)
Test::Unitのインストール(Test::Unit)(2)
Test::Unitのインストール(Test::Unit)(1)
Test::Unitのインストール(Error)(5)
Test::Unitのインストール(Error)(4)
Test::Unitのインストール(Error)(3)
Test::Unitのインストール(Error)(2)
Test::Unitのインストール(Error)(1)
Test::Unitのインストール(Devel::Symdump)(5)
Test::Unitのインストール(Devel::Symdump)(4)
Test::Unitのインストール(Devel::Symdump)(3)
Test::Unitのインストール(Devel::Symdump)(2)
Test::Unitのインストール(Devel::Symdump)(1)
Test::Unitのインストール(Class::Inner)(5)
Test::Unitのインストール(Class::Inner)(4)
Test::Unitのインストール(Class::Inner)(3)
Test::Unitのインストール(Class::Inner)(2)
Test::Unitのインストール(Class::Inner)(1)
Test::Unitのインストール(1)
Test::Unitのダウンロード(Error)
Test::Unitのダウンロード(Devel::Symdump)
Test::Unitのダウンロード(Class::Inner)
Test::Unitのダウンロード(Test::Unit)
Test::Unitのダウンロード(1)
DBI/DBD-pgサンプル(selectall_arrayref)
DBI/DBD-pgサンプル(fetchrow_array)
DBI/DBD-pgサンプル(selectrow_array)
DBI/DBD-pgサンプル(prepare)
DBI/DBD-pgサンプル(do)
DBI/DBD-pgサンプル(disconnect)
DBI/DBD-pgサンプル(connect)
DBI/DBD-pgサンプル(テーブル作成)
DBD-Pgのインストール(5)
DBD-Pgのインストール(4)
DBD-Pgのインストール(3)
DBD-Pgのインストール(2)
DBD-Pgのインストール(1)
DBD-Pgのダウンロード(1)
DBIのインストール(5)
DBIのインストール(4)
DBIのインストール(3)
DBIのインストール(2)
DBIのインストール(1)
DBIのダウンロード(1)