タグ

vowsに関するToQozのブックマーク (4)

  • VowsとZombie.jsでExpress, MongooseなNode.jsアプリのテストを書いたよ - bojovs::blog

    環境 Node.js 0.4.9 Express 2.4.6 Mongoose 2.2.2 Vows 0.5.11 Zombie.js 0.10.1 request 2.1.1 流れ 最初に、モデル内のドキュメントを削除するコードと、サーバを起動するコードを記述します。 test/helper.js 1 var mongoose = require('mongoose') 2 , app = require('../app') 3 , Post = require('../models/post').Post 4 , User = require('../models/user').User; 5 6 var serverActivity = false 7 , models = [Post, User]; 8 9 10 process.on('exit', function () { 1

  • Node.js + Vowsではじめるテスト駆動開発

    Node.jsで使えるTDD, BDDフレームワークはいくつかあるのですが(nodeunit, Jasmine, etc)コールバック・イベント周りのテストのしやすさとCoffeeScriptが利用出来る Vows が非常に熱い感じです。 特にテストコードをCoffeeScriptで(別途コンパイルせずに)そのまま記述出来るのは、テストコードの可読性を考えると大きなメリットだと思います。 Vowsのインストール# VowsはNode Package Manager(npm)でインストールする事が出来ます。vowsコマンドを有効にするためにカレントディレクトリの node_modules の他にグローバルにも入れておきましょう。 npm install vows npm install -g vows Vowsを使った開発手順# サンプルとして自分のフルネームを返す事しか出来ないPerson

    Node.js + Vowsではじめるテスト駆動開発
  • Vows « Asynchronous BDD for Node

    Asynchronous behaviour driven development for Node. There are two reasons why we might want asynchronous testing. The first, and obvious reason is that node.js is asynchronous, and therefore our tests should be. The second reason is to make tests which target I/O run much faster, by running them concurrently. Write some vows, execute them: $ vows test/* --spec Get the report, make sure you kept yo

  • Vows で クライアントサイドの CoffeeScript / JavaScript のテストをする時の Tips

    0. node.js の Vows フレームワークがとてもかわいい JavaScript のTDD, BDDフレームワークはたくさんあるけど,テスト結果の見た目の良さと記述の楽さで Vows というフレームワークを使っている.RSpec からの影響を受けていて,Rack アプリケーションのテストと同じような感覚で書ける,というのが良い. たとえばこんな感じでテストコードを CoffeeScript で書く で --spec オプションをつけて実行するとこういう風に表示してくれる. assertion でテストが通らないと黄色く,内部エラーの場合は赤にラベルが表示される. しっかり全部通すと このように表示される.見た目が良いし,ラベリングを丁寧にやるとテストの内容がわかりやすい. 元々 node.js のテスト用なので,require exports など, pure JavaScript

    Vows で クライアントサイドの CoffeeScript / JavaScript のテストをする時の Tips
  • 1