こんにちはDMM.comラボCTO室の加嵜です。 記念すべきDMMエンジニアブログの第1回目ということで、今回は、mochaというJavaScriptのテスティングフレームワークと、mocha-phantomjsを使って、クライアントサイドのJavaScriptテストの自動化を紹介します。 mochaでテスト駆動開発 まず、mochaを使ってクライアントサイトJavaScriptの簡単なテスト駆動開発を実践してみます。 今回使用するのは、mocha本体と、mochaでアサーションを記述するためのchaiというライブラリです。 mocha http://mochajs.org/ chai http://chaijs.com/ 事前準備 事前準備として、htmlで読み込むmocha.js, mocha.css, chai.jsファイルを入手します。npm, bower等を使って自動でダウンロー