You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
As JavaScript has matured as a language, the module has become the primary unit of code organization. However, as with many facets of JS, modules grew organically from the developer ecosystem (as opposed to being designed as part of the language from the beginning), so they have their flaws – one being that you can only export one interface, and any functions not exported through the interface are
Improve Your Tests by Breaking the RulesPosted by Mike Pennisi For many developers, writing tests is a hassle that would be best put off till tomorrow. For one, nothing can compete with the direct impact of writing great application logic. No user ever shared feedback like, “The UI was really pleasant and the functional tests were well-organized and readable.” There’s not much I can say to change
平均を求める関数 function average(arr) { var result; var sum = 0; for (var i = 0, len = arr.length; i < len; i++) { sum += arr[i]; } result = sum / arr.length; return result; }
13 Jul 2014 edit My team at Bazaarvoice has been spending a lot of time lately thinking about quality and how we can have greater confidence that our software is working as it should. We've long had functional tests in place that attempt to ask questions like "When a user clicks a button, will The Widget do The Thing?" These tests tell us a fair amount about the state of our product, but we've fou
chai というアサーションライブラリがあって、テストフレームワークの Mocha と合わせてよく使われていると思うのだけど、その chai のプラグインを書いた。 chai-deep-closeto このプラグインを使うと配列にも closeTo が使えるようになる。 expect([ 1.5, [ 2.5, 3.5 ], 4.5 ]).to.be.deep.closeTo([ 1, [ 2, 3 ], 4 ], 0.5); chai のプラグイン chai はプラグインで便利機能を拡張する前提で設計されていて、各種プラグインが公開されている。たとえば有名なのではテストスパイとかスタブを扱う Sinon.JS を chai のインターフェースで使える sinon-chai とかがある。他にもある → Chai Plugins chai のプラグインの書きかた 簡単に書ける。プラグインを適
By Michael Phillips, Engineer On October 17, 2012, Bryan Helmkamp, founder of Code Climate, wrote a blog post outlining 7 patterns to refactor fat ActiveRecord models in Ruby on Rails. Here at Crush & Lovely, this post is a core reference for all Rails developers on how to separate concerns, write modular, concise and expressive code, and make testing exceedingly simple. This series of posts demon
今まではなんとなくtestemを使っていたのですが、Karmaを検討する必要があったので試してみました。 サンプルの設定などは↓で見ることが出来ます。 https://github.com/koba04/backbone-boilerplate testem to karma これまでは業務でもtestemを使っていて、テストの数が少ないうち(1000以下)は問題なかったのですが、 段々テストが増えてくるとCPU100%になってテストが走るブラウザが固まることが増えてきて辛い感じになってきました。 そんなときに下記の記事を見て同じような現象だなと思いKarmaを試してみることにしました。 http://developer.cybozu.co.jp/tech/?p=7089 Installation インストールはnpm install karmaするだけです。 globalでkarmaのコ
Tools, patterns & Architecture By Enrique Amodeo / @eamodeorubio Enrique Amodeo (who is this guy?) Programming since 1984 Currently Software Engineer at SoundCloud Has loved JS since 2005 Test infected Enthusiast of the Agile/Lean way Follow me at @eamodeorubio This talk To cucumber or not to cucumber No need to test the UI? I want my UI tested Testing xBrowser issues Maintainable tests Conclusion
こんにちは。kintone開発チームの天野 (@ama_ch) です。 最近はJavaScriptのテストツールが著しく進歩し、日々新しいツールが登場しています。kintoneの開発もこれらのツールによって支えられています。 kintone開発チームでは、昨年末頃からテスト環境の改善に取り組み、モダンなツールセットに乗り換えました。今回は、現在のkintoneのJSユニットテスト環境について紹介します。 kintoneとJSユニットテスト 数年前からユニットテストと自動化の仕組みはあったのですが、ごく一部のユーティリティ関数に書かれているのみで、普段の開発には活用されていませんでした。 ここ1,2年ほどで テストスケルトンを生成するジェネレータスクリプトを作る テストの書き方をまとめたドキュメントを用意する MTGで「ユニットテストを書かなくていいのは小学生まで」などと煽る コードレビュー
本連載は、テストコードをこれから書こうと考えているJavaScript技術者を対象に、テストコードの意義から、テスト駆動開発、JavaScriptでのテストコードの書き方、継続的インテグレーションなどテスト全般にわたって解説します。また、原理原則だけでなくWhyから説明し、チームメンバーを巻き込みながら開発現場に活かせる考え方を総合的に解説します。第4回目の本稿は、JavaScriptでのテストダブルの方法を、Sinon.jsというJavaScriptテストダブルモジュールを使って説明します。 対象読者 JavaScriptの基本をある程度理解している方 テストコードをこれから書こうと考えている方 テストダブルとは テストコードを実行する際に、次のような課題に直面したことはないでしょうか。 Ajaxへのサーバへの問い合わせのような外部リソースも含めた処理のテストを行う必要があるが、テストデ
promise-test-helper azu/promise-test-helper という名前そのままですが、 Mocha等でPromiseのテストを書くときに見落としを減らすための補助ライブラリを書きました。 MochaのPromiseテストというのは、下記のようにpromiseオブジェクトを返すとそれをPromiseのテストと認識してやってくれる機構の事を言っています。 it("should support by mocha", function () { return getSuccessPromise().then(function (value) { assert(value); }); }); 詳しくは下記を見て下さい。 MochaがPromisesのテストをサポートしました | Web scratch Promiseのテストの難しさ Promiseのテストについてはazu
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く