Skip to content

Instantly share code, notes, and snippets.

@oooooooo
Last active December 30, 2015 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oooooooo/7801314 to your computer and use it in GitHub Desktop.
Save oooooooo/7801314 to your computer and use it in GitHub Desktop.
テスト

目次

テスト

そのままではテストできない太古のプログラムは正規表現でメソッドを抜き出してテストする気概で。

テストのないコードがレガシーコード。自分が新たな技術的負債を作らないために。

Test::More

基本。

おまけ。

Test::WWW::Mechanize::PSGI

ブラウザで入力、確認の流れなどのテストに。

使用例。

PSGI 化されていない CGI も PSGI のテストが流用できます。

use Test::More;
use Test::WWW::Mechanize::PSGI;
use Plack::App::CGIBin;

my $mech = Test::WWW::Mechanize::PSGI->new(
    app => Plack::App::CGIBin->new(root => "t/cgi-bin")->to_app,
);
$mech->post_ok('/foo.cgi', {name => 'bar', title => 'baz'});
$mech->content_is("buzz\n");

Wight

JavaScript のテストに。

Test::WWW::Selenium

ブラウザの挙動テストに。

参考資料

次のステップ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment