移転しました http://please-sleep.cou929.nu/20121211.html
移転しました http://please-sleep.cou929.nu/20121211.html
最近、私の中で Backbone.js と共に注目の Jasmine のドキュメントを和訳しました。 本家のドキュメントはこちらです。 和訳したものはこちらです。 (もし、訳で怪しいところがあればご指摘ください。) http://mitsuruog.github.com/jasmine/ ちなみに Jasmine は Javascript のテスティングフレームワークの 1 つです。 他のフレームワークを満足に扱ったことがないので、あまり偉そうなことは言えませんが、特徴として次のようなことを挙げておきます。 standalone 版(JS ファイル)があり、ブラウザのみでテスト実行と結果の確認ができる。 テストケースのネストが可能、(Java で言うことの)setUp、tearDown 機能がある。 豊富な matcher。 Mock(Spy)が割と簡単に作れる。 jasmine-jque
はじめに Rails アプリの JavaScript のテストは capybara(+capybara-webkit) を使えば一応できるけど、統合テストなのがね…。統合テストもちゃんと書くけど、やりたいのは JavaScript の単体テストなのに。 そこで Evergreen そんな中で最近知ったのが Evergreen っていう gem。 jnicklas/evergreen · GitHub こいつを簡単に説明すると、Rails に組み込める Jasmine テストランナー。Jasmine も同梱されてるので、インストールすればすぐに JavaScript のテストが書ける。 Evergreen のインストール Gemfile に group :test, :development do gem "evergreen", :require => "evergreen/rails"
「ALM Advent Calender」2日目への参加記事になります。 ソフトウェアを開発する際にテスト開発、実施、管理をもっと効率化したいとずっと考えています。 幸いにも自分たちの開発チームもTFSを導入することができたことで、Test Managerなどを利用して開発チームのテスト実施や管理が効率よく行えるようになってきています。 ありがたいことです。 そんな中、JavaScriptの開発はJSLintでコード検証、JsUnitでテストをしています。 悪くはないんですが、もう少し効率良くしたい、と考えていたときにChutzpahに出会いました。 Chutzpahで単体テスト Visual Studio 2012ではソリューションビルド時に使用可能なテストを検出し、「テスト エクスプローラー」に表示・実行してくれます。 テスト エクスプローラーを使用した単体テストの実行 Chtzupa
I don't think I need to convince you that testing your JavaScript code is a good idea. But, it can sometimes prove tedious to test JavaScript code that requires a DOM. This means you need to test your code in the browser and can't use the terminal, right? Wrong, actually: enter PhantomJS. What exactly is PhantomJS? Well, here's a blurb from the PhantomJS website: PhantomJS is a headless WebKit wit
各質問に答えていくと設定ファイルができあがります。 今回はテストフレームワークはjasmine、 ブラウザはChrome、Firefox、Safariとしています。 ※各質問の選択肢はタブで切り替えられます。 Which testing framework do you want to use ? Press tab to list possible options. Enter to move to the next question. > jasmine Do you want to capture a browser automatically ? Press tab to list possible options. Enter empty string to move to the next question. > Chrome > Firefox > Safari > Whic
この記事は賞味期限切れです。(更新から1年が経過しています) JavaScriptユニットテスト一年生の私が、Nettuts+ のチュートリアルで知ったテストツール 「testem」のお陰で大変捗ったので是非お勧めしたく、ここで紹介してみます。 testem ってなに testem via GitHub : airportyh/testem Unit testing in Javascript can be tedious and painful, but Testem makes it so easy that you will actually want to write tests. 要するに、面倒なJSのユニットテストをより快適にしてみんなでハッピーにテスト書こうよ!というツールです。 testem自体はnode.jsベースで動作し、Jasmine/QUnit/Mochaに対応して
jQuery.ajax()の非同期通信で実行順序を保証する方法を紹介します。 具体的には、jQuery.ajax()による非同期通信を連続して実行する場合やjQuery.ajax()メソッドによる非同期通信と他の処理を続けて実行する場合、お互いの実行順序を保証する方法です。 本エントリーではjQuery1.8を使って解説します。その関係で、done()メソッドを使っています。done()がサポートされていないバージョンであればsuccess()に読み替えてください。 1.jQuery.ajax()の仕様 「仕様」という表現は適切でないかもしれませんが、例えばjQuery.ajax()による非同期通信を連続実行した場合、実行結果の順序は不定です。 簡単なサンプルとして、for文の中でjQuery.ajax()を実行するコードを用意しました。 <meta charset="utf-8" />
PhantomJSとJasmineで振る舞い駆動開発なJavaScriptテスト:フレームワークで実践! JavaScriptテスト入門(2)(1/3 ページ) しっかりとJavaScriptをテストするために、今注目のJavaScript用のテストフレームワークをいくつか紹介し、その概要から実践的な使い方まで解説する連載 前回は、JavaScriptテストの基本、今回からフレーワムークを紹介 前回の「JavaScriptテストの基礎知識と使えるフレームワーク6選」では、JavaScriptのテストを取り巻く環境や、JavaScriptのテストに使用できるフレームワークの紹介を行いました。今回からは、前回の記事で紹介されたフレームワークを使用して実際にJavaScriptのテスト環境を構築し、テストを行うまでの流れを解説します。 今回は「PhantomJS」と「Jasmine」を取り上げま
A Comprehensive Guide to Understanding TypeScript Record Type
QUnitとは? † JQueryプロジェクトでも利用されているJavaScriptのユニットテストフレームワーク。 結果レポートの出力やブラウザAPIを利用して主にHTML上で実行することを前提に作り込まれているが、Node.jsなどのCLI環境でも実行可能なように内部ロジックの調整は行われている。 ↑ Getting Started † 以下内容のHTMLを作成してブラウザで開く。 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>QUnit Example</title> <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.10.0.css"> </head> <body> <div id="qunit"></div> <script
Google Analytics is a great tool for tracking events happening on your website. Yet ensuring that correct information is being recorded can be a tedious task. For my most recent engagement I needed to add analytics support to a large number of pages with challengingly different environments. There was a constant worry that some rules would collide with others or not fire correctly when juxtaposed
東京Node学園祭2012 アドベントカレンダーの9日目です。Node.jsとほとんど関係ないうえに内容がけっこう薄い感じなった気がするんですけど気にせずいこうと思います。 フロントエンドのJavaScriptをテストするとき最近はいつもmochaを使ってるんですが、やはりJenkinsとかtravis-ciを使って自動テストもしたいと思って試してみました。 hokaccha/mocha-phantom-travis-test ここではよくあるjQueryで画像のロールオーバーをするというプラグインを作ってそのライブラリに対してテストを書いています。ソースコードはこんな感じです。 $.fn.rollover = function() { return this.each(function() { var $img = $(this); var src = $img.attr('src');
Presented at the Burlington Ruby Conference on July 28th. Learn just how easy it is to test your JavaScript and CoffeeScript code. Don't be scared by events, DOM interactions, or AJAX requests any more!
JavaScriptのユニットテストは2年ほど前にQUnitから入って、最近はもっぱらJasmineを利用していました。近年のJavaScriptテスト関連情報をまとめたいなと思い、改めてQUnit最新Version1.10.0のドキュメントとソースを読んで仕様を把握して資料にまとめてみました。 Qunit1.10.0 from Koji Nakamura サーバーサイドJSを開発する時にQUnitを採用する選択肢は僕の中ではないのですが、ブラウザJSを開発する時にはこのシンプルさと導入のしやすさはやはり利点だなと再認識した次第です。
AngularJSで使われてるTestacularではWebStormからテストを実行してデバッグする事を想定した作りになっています。 (AngularJS自体もJetBrains Plugin Repository :: AngularJSプラグインがあります) Testacular – Spectacular Test Runner for JavaScript WebStorm Testacular Documentation — Testacular 0.2.1 documentation 公式のデモ動画(Testacular – JavaScript Test Runner – YouTube)でもWebStorm Integrationが紹介されていますが、 ちょっと古くて設定が変わってる(一応キャプションで補足入ってる)のと分かりにくいので、その部分だけ抜き出して紹介します。
最近、何かとJavascriptに触れる機会が多くなってきました。クライアント側としてHTML5が注目され、サーバ側としてNode.jsが発展してきたおかげですね。その一方で、Javascriptのテストほど面倒なものはありません。特に、ブラウザ上でのテストなど自動化することが時に難しかったりします。このブラウザ上でのテストを自動化できる仕組みがJsTestDriverです。今回はJsTestDriverの導入方法と簡単な使い方をご紹介します。 JsTestDriverとは JsTestDriverはGoogleが作ったテストフレームワークです。導入も使い方もとても簡単であり、様々なブラウザを使ったテストを自動化することが出来ます。Javascriptのテストフレームワークは多数ありますが、その中でもJsTestDriverは簡単かつ正確なツールです。 JsTestDriverの導入 導入
最近仕事ではNode.jsしか書いてないtoritoriです。 お仕事でもexpressやsocket.ioを使っているのですが WebアプリケーションのテストについてWeb上にあまり書かれていないような気がします。 特にソケット接続した後のメッセージ送信/受信の部分です。 今までのようなHTTPの単純なリクエスト/レスポンスとは手法が異なりますしどうしたものかと。 そこで「自分はこんな感じでテストしてますよー」という記事を書いてみます。 裏を返せば「もっといい方法あるよ!」というのを聞きたいのです>< サンプルについて socket.ioのexample を使います。 ただし、サンプルではログイン時に遷移しない方式なので もう少し実用的な動作に近づかせるため あえてログインURLから遷移するようにし、 セッションもRedisを使うようにしてexpressとsocket.ioでセッションを
シンガポール在住のソフトウェア開発者です。なんだかんだでシンガも4年目突入。仕事もしくは趣味でやっていることをまとめています。 英語のブログは http://atmarkplant.com にあります 今回は, JavaScript のテストを行うためのフレームワークJasmine の紹介です。 JavaScript のテストといえば, JSUnit が有名です。 JSUnit は, JUnit とに似たような, Matcher が利用できたりしてわかりやすいのですが, 開発やメンテナンスがストップしており, またWebプロジェクトに組み込まないと利用できないことが ちょっと残念です。 JUnit のページでも紹介があるように, 今後は Jasmine というフレームワークを開発していくようです。 ※Matcher : ここでは, assertEqual などの, verify のための
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く