はじめに
おはようございます。当ブログにアクセス頂き、ありがとうございます。『名は体を表わす』の通り、健康でふくよかボディのたなけんです。
本エントリでは、アプリケーションのテストおよびCIツールの導入について記載いたします。
アプリケーションのテスト(2)
本日は以下のテストコードを紹介します。- xml抽出関数のテスト
- JSON生成関数のテスト
- url構築からJSON文字列生成までを結合した関数のテスト
xml抽出関数のテスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(deftest test-extract-xml | |
(is (core/extract-xml test-url) | |
test-xml)) | |
(deftest test-extract-xml-ioe | |
(is (thrown? myDictionary.java.AppException | |
(core/extract-xml "")))) |
- 正常系: 正常urlを引数に、想定されるxmlが抽出されるかをテスト
- 異常系: 異常urlを引数に、想定される例外が発生するかをテスト
JSON生成関数のテスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(deftest test-generate-json | |
(is (core/generate-json test-xml) | |
result-string)) | |
(deftest test-generate-json-saxe | |
(is (thrown? myDictionary.java.AppException | |
(core/generate-json "")))) |
- 正常系: 正常フォーマットのxml文字列を引数に、想定されるJSON文字列が生成されるかをテスト
- 異常系: 異常フォーマットのxml文字列を引数に、想定される例外が発生するかをテスト
url構築からJSON文字列生成までを結合した関数のテスト
正常系: 単語を引数に、想定されるJSON文字列が生成されるかをテストCIツールの導入
参考にさせて頂いたサイトのリンクをご紹介いたします。今回の作業は以上。最後までお読み頂きありがとうございました。
たなけん (作業時間30分(各種インストールは除く))
0 件のコメント:
コメントを投稿