タグ

関連タグで絞り込む (2)

タグの絞り込みを解除

JUnitとtestingに関するoinumeのブックマーク (6)

  • Springで単体テスト - Develop with pleasure!

    SpringFrameworkをベースに開発をしてるということは、テスト時も必要な個所は(DataSourceのインジェクションや、ORM使ってたらiBATISの場合は、SqlMapClientのインジェクション)ApplicationContextの設定を引き継いだ状態でテストをしたい。Springでは予めapplicationContext.xmlを読み込んでくれるサポートクラスが存在する。 例えばDAOのテストケースであれば、AbstractTransactionalDataSourceSpringContextTestsといったクラスが提供される。また、applicationContext.xmlを読み込むよう、org.springframework.test.context.ContextConfigurationというアノテーションが用意されている。 AbstractTrans

    Springで単体テスト - Develop with pleasure!
  • Running a Junit test remotely, as if it were running locally, using Eclipse

    I've search around, read relevant questions on this site and others, but have failed to find a solution. It strikes me odd that one does not exist so let me detail my question here: I use Junit4 + Eclipse regularly to test my code. In some cases, certain tests can take a lot of CPU and/or memory, rendering my workstation unusable for the duration of the test. This is a pain I'm trying to solve. I'

    Running a Junit test remotely, as if it were running locally, using Eclipse
  • hamcrestのMatcherメモ - 都元ダイスケ IT-PRESS

    技術ネタじゃないところで盛り上げてしまった。技術ネタいこう、技術ネタ。 さて、JUnitを使う際、hamcrestライブラリを使って、英語として読めるようなassertionを書く、なんてのは流行ってたり流行っていなかったり? JUnit4限定だけれど、assertionの際、assertEqualsとか色々assertionのメソッドはあるけど、全てassertThatで書くことができるはず。assertThatメソッドの第一引数にテスト対象、第二引数にhamcrestのMatcherインターフェイスの実装を与えます。なんのこっちゃですが。 Jiemamyでは、なるべくassertThat以外のassertionメソッドを使わないようにテストを書いています。(もしかしたらもう一つも残ってないかも。) まぁ、以下のように書くと、英語っぽいのが書けますよ、と。 assertThat(aaaa

    hamcrestのMatcherメモ - 都元ダイスケ IT-PRESS
  • JUnit 4.10の標準で使用できる比較構文(マッチャー)

    JUnit 4.10をEclipseで使えるようにしました。 EclipseでのJUnit 4.10の使い方 JUnitの使い方がなんとなくわかったので、標準で比較に使用できる構文を調べてみます。 登場するマッチャー ・等価であるか:is() ・等価でないか:not() ・nullであるか:nullValue() ・nullでないか:notNullValue() ・指定したインスタンスか:instanceOf() ・同じインスタンスか:sameInstance() ・全ての条件を満たすか:allOf() ・いずれかの条件を満たすか:anyOf() ・値は何でもよい:anything() ・トレースに表示する文字列を変更:describedAs() 等価であるか:is() 値が等価であるかチェックするには、is()を使用します。 必要なimport

    JUnit 4.10の標準で使用できる比較構文(マッチャー)
  • assertThatのMatcherとHamcrest - 日々常々

    JUnit API探訪:Assertクラス/assertThatメソッド - Shinya’s Daily Report 人のブログに乗っかってなんか書くパターン。 そしてこれらとは別にorg.hamcrest.Matchersというクラスも存在。これが一番提供メソッドも多いようなので今回はこちらのクラスメソッド群について色々写経しつつ、機能・概要を把握して行く事にする。(※このライブラリに関するJavadoc APIを見たほうが手っ取り早いと思ったんだけど、サイト経由では公開されてるJavadoc APIは確認出来ず。何でだろ?) http://d.hatena.ne.jp/absj31/20120811/1344759958 HamcrestのJavadoc、無いんですよねー。なのでどっちか。 zipでおk http://code.google.com/p/hamcrest/downl

    assertThatのMatcherとHamcrest - 日々常々
  • Quick JUnit process call Extension が便利すぐる - 宇宙行きたい

    JUnit実行後にプロセスに通知するプラグイン - Fly me to the Juno! Ubuntu で notify-send でやってた。 超便利なんだけど、テスト失敗した時と成功した時で表示を分けないと、僕の脳は成否を判断してくれなかったので、 簡単にスクリプト書いてみた。 #!/usr/bin/env python # -*- coding: utf-8 -*- import sys import pynotify def main(): if len(sys.argv) is not 3: return summary = sys.argv[1]; detail = sys.argv[2]; img = "dialog-info" print summary if summary not in 'Quick JUnit Test OK': img = "dialog-warn

    Quick JUnit process call Extension が便利すぐる - 宇宙行きたい
  • 1