平均を求める関数 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; }
平均を求める関数 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
May 14, 2014 (Updated December 18, 2014) Setting up good testing can be tricky no matter what language you’re in. JavaScript’s flexibility can make your tests powerful in terms of access, but if you’re not careful that same flexibility can leave you tearing your hair out the next day. For instance, how do you test API callbacks? How do you deal with require? Without a proper setup, whether TDD is
Jest is a delightful JavaScript Testing Framework with a focus on simplicity.
NOTE: Laika is an archived project and there are some other alternatives you can use instead: Velocity - Meteor's Official Testing Framework Gagarin - Testing Framework Very Similar to Laika Laika is a feature rich testing framework for meteor. With laika you can simply write tests that interact with both server and client(s). Installation and Setup First install laika from npm sudo npm install -g
Automated e2e testing- WebDriverJS, Jasmine and Protractor e2e or end-to-end or UI testing is a methodology used to test whether the flow of an application is performing as designed from start to finish. In simple words, it is testing of your application from the user endpoint where the whole system is a blackbox with only the UI exposed to the user. It can become quite an overhead if done manuall
AngularJSを利用したのなら、絶対にKarmaとか Protractorを活用すべきです。ちゅうか、活用しなさい。と言いたいです。システムを保守フェーズに安定的にメンテナンスするならそう考えるのがふつうになるべき。 (※Protractorについては、こちらの記事がとても参考になります) 例によって「Mastering web application development with AngularJS」を読んで書かれていたポイントを読んだ感想をこちらにまとめてますが、 2章のテスト解説部分に下記の文章があります。 There is a quote saying that writing code without a Version Control system (VCS) is like skydiving without a parachute. Today one would
※この記事は社内勉強会向けの資料の下書きです。書きなぐりの下書きで見直すと最後の方の文書がヤバいので、いつか書き直します。読み辛い所は申し訳ないです。 概要 TDD テスト自動化とTDDを整理 TDDとBDDの違い Test Framework in javascript QUnit/jasmine/mochaについて、違いやメリデメを知る mocha 基本的な書き方 アサーションライブラリのメリデメを整理する chai 記述形式の違い整理 基本文法 sinonjs spy stubs mock TDD Test Driven Development テスト駆動開発 by ケントベック 特徴 xUnit系/BDD系のテストフレームワーク使う テストするコードも実装 テストファースト 実装の後にテストするのではなく、テストを先に書いて実装する サイクル Red(失敗) => Green(通過
このpromiseオブジェクトは、resolveするので、.then の第一引数で指定したonFulfilled コールバックに true という値を渡すようになってます。 今までのテストの書き方 このgetSuccessPromiseを 1.18.0より以前は以下のように書くことでテストをしていました。 it("should manually handling test...", function (done) { getSuccessPromise().then(function (value) { assert(value); done(); }).catch(done); // <= このcatchが今回の変更での焦点 }); getSuccessPromise()の返り値であるpromiseオブジェクトがresolveされると value に true が入って assert(t
あなたにとって重要なトピックや同僚の最新情報を入手しましょう最新の洞察とトレンドに関する最新情報を即座に受け取りましょう。 継続的な学習のために、無料のリソースに手軽にアクセスしましょうミニブック、トランスクリプト付き動画、およびトレーニング教材。 記事を保存して、いつでも読むことができます記事をブックマークして、準備ができたらいつでも読めます。
2014年1月17日、ベルサール新宿グランドにて開催された「エンジニアサポートCROSS 2014」の中の1セッション「実況解説つき!ペアプロでわかるJavaScriptテスト入門」をレポートします。 エンジニアサポートCROSS 2014とは 「複数の技術を身につけなければWebサービスは作れない=クロスしないと生きていけない」をテーマに、「エンジニアサポート新年会2012 CROSS」として第一回が2012年に開催された勉強会イベント、それがCROSSです。今年で3回目になります。 「実況解説つき!ペアプロでわかるJavaScriptテスト入門」 このセッションは「JavaScriptで書かれたよくあるコードをベースに、ペアプロでテストコードを足していく様子を解説者が説明する」という内容になります。 それでは、さっそくセッションの模様を見ていきましょう。 登壇者 本セッションの登壇者
ってsinonのスタブ漏れを探しながら何度目かわからない感じにキレてた。 とにかく仕事でJSのテスト書くのが辛いので考えてみる。比較的JSのテストに慣れてる自分ですら辛いのだから、世界はもっと辛いに間違いない。サーバーサイドのnode.jsの話ではない。 JavaScriptで完結しない 構造がHTMLの構造と密結合している。装飾や位置、表示/非表示はCSSによって制御されている。 クライアントJSはHTMLと密結合しており、CSSからビューは影響を受ける。それらがネットワークの結果を受け非同期に振る舞いを帰る。その最終的な値を取得するのが難しい。 もちろんサーバーサイドだってDBやネットワークという外部リソースを扱うが、モックの手法が確立しているし、局所的な複雑度は、JSの方がはるかに多い。 言語仕様が貧弱 mochaやjsmineはrspecを真似てるけど、本質的にJavaScript
One framework for all platforms Mobile webTest on your web apps on real mobile devices, and scale easily by connecting to cloud grids Native mobileTest your native iOS and Android apps with Nightwatch Real desktop browsersTest on real browsers which accurately reflect your users’ environment Searching for bugs just got easy PinpointIdentify the source with the built-in HTML reporter with test stat
CoverallsというGitHubのプロジェクトのテストカバレッジを記録するためのサービスがあって、クライアントサイドのJavaScriptのテストでもできそうだったんでやってみた。 最近のJavaScriptのカバレッジツールはBlanket.jsがいけてるらしいんだけど、これを使ってクライアントサイドJavaScriptのカバレッジをCoverallsに投げるの若干めんどそうだったんで、ponchoっていうラッパーを使ってみた。 ponchoはMocha、PhantomJS、Blanket.jsをうまいことつないでくれるやつで、普通にMochaでテスト書いてるプロジェクトだったらすごく簡単に設定できる。Mocha限定になっちゃうけど。 すでにMochaでテストが書かれてて、test/index.htmlとかでテスト実行できる(ブラウザで開いてMochaのテストが走る)とすると、まず、
Unit-testing Backbone Views is hard. You need to cover enough for the test to be meaningful (for example DOM updates and server calls), without getting too tangled up in gory details. In this post I’ll talk about how we use QUnit and Sinon.JS to unit-test our Backbone views. There’s already material out there on using these frameworks together, so I’m not going to get into setting things up. Howev
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く