[ここに挿入言語]のテストフレームワーク
-
21-08-2019 - |
解決
これはAPIレベルで作業している前提としています。私は間違ってそれを読んで、あなたはGUIレベルで作業している場合は、セレンまたはワチールのようなものを検討しやすいです。
あなたはTAP結果(テスト何プロトコル)を出力し、独自の簡単なテストフレームワーク書く考えがあります - ?その後、グラインドやTAP2HTMLであることを解析し、
真剣に、TAP出力は次のようになります:
1..7 ok 1 - hello world with null value returns 'hello world' string ok 2 - hello world with bob returns 'hello, bob' ok 3 - hello world with 123 return 'hello, 123' ok 4 - hello world with 5K string return hello plus string ok 5 - special characters ok 6 - internationalization, fr ok 7 - internationalization, ja Looks like you failed 0 tests of 7.
(それはステップ5の後に死亡した場合は、1..7は、何かが間違っているあなたを言うだろう)。
出力はストレートASCIIです。あなたは基本的に2つのグローバル、numTestsTotalとnumTestExecutedを持っており、このような関数を記述します。
sub ok (boolean bExpected, string comment) { if (bExpected) { print "ok " . numTestsExecuted . " " . comment . "\n"; }else { print "not ok" . numTeststotal . " " . comment . "\n"; } numTestsExecuted++; } sub eq(int iExpected, int iResult, string comment) { if (iExpected==iResult) { print "ok " . numTestsExecuted . " " . comment . "\n"; } else { print "not ok" . numTestsExecuted . " " . comment . \n"; } numTestsExecuted++; }
次に、あなたのテストアプリケーションは、ライブラリおよびテストモジュールが含まれ、ライブラリ内の定期的なコードを記述します。
あなたは価値のすべてのタイプのEQをオーバーロードすることができ、書き込みはなど、配列を比較することです。
TAP上のドキュメントを参照してください: http://testanything.org/wiki/index.php/Main_Pageする
はい、あなたはそのEQを主張する可能性が() "だけ")(OK呼び出す必要があります。それとも、出力で、期待と実際の結果を挿入することができます。あなた次第ます。
とにかく、より多くの命令型言語のためのTAPパーサと通訳がたくさんあります。
所属していません StackOverflow