Skip to content

Instantly share code, notes, and snippets.

println "hello! install from gru"
@kyonmm
kyonmm / jggug-junit-groovy-summary.md
Last active January 4, 2016 21:19 — forked from anonymous/jggug-junit-groovy-summary.md
2/21(金)のG* ワークショップZ でのハンズオン概要

JUnit4を利用したテスティングフレームワーク開発

自己紹介

  • kyon_mm
  • 名古屋市内企業に勤務しているテストアーキテクト
  • CI, DVCS, ITSなどの開発環境サポート、テスト戦略策定、テスト自動化などがメイン業務
  • .NETアプリに対してGroovy, C#, F#, Scalaなどでテストコードを実装することが多い
  • SCMBootCamp, Nagoya.Testing, 基礎勉強会などを主催

開催概要

GroovyにはSpockというCoolなテスティングフレームワークが存在しますが、特定チームに最適であるかはまた別の話になります。今回はJUnit4のAPIを使ってオリジナルのテスティングフレームワークを作るハンズオンを行います。基本的にはxUnitでテストコードを書いたことがあり、JavaもしくはGroovyの基本文法を理解していれば大丈夫です。

#############################################################
################### OFFICIAL UBUNTU REPOS ###################
#############################################################
###### Ubuntu Main Repos
deb http://jp.archive.ubuntu.com/ubuntu/ precise main restricted universe
deb-src http://jp.archive.ubuntu.com/ubuntu/ precise main restricted universe
###### Ubuntu Update Repos
deb http://jp.archive.ubuntu.com/ubuntu/ precise-security main restricted universe
@kyonmm
kyonmm / HogeSpec.groovy
Last active December 22, 2015 15:39
Spockテンプレ。 curl -s get.gvmtool.net | bash でインストール。gvm install gradle.  projectディレクトリをつくって、そこにbuild.gradleをコピーして、gradle --daemon idea. open hoge.ipr. src/main/groovyとsrc/test/groovyを作成してsourceとtestとして指定する。あとは書く。 importとかの自動生成は赤線に合わせてAlt + Enterだった気がする。
import org.spock.*
class HogeSpec extends Specification {
@Unroll
def "sample #a #b #expected "(){
given:
println "$a $b $ expected"
when:
println "$a $b $ expected"
then:
@kyonmm
kyonmm / TDDeXchange-exercise-for-tdder.md
Last active December 7, 2022 05:21
TDD演習課題 - TODOリストアプリ
@kyonmm
kyonmm / fsLineCounter.groovy
Created May 31, 2013 04:40
F# のコメントと空白行を除いた行数を出力します。ざっくり実装です。起動引数にディレクトリを指定すると、配下のフォルダ全てのfsファイルを対象に行数を出力します。
import groovy.io.FileType
def multiLineComment = false
new File(args[0])
.eachFileRecurse(FileType.FILES){
if(it.name.endsWith("fs") == false) { return }
println it.name + "\t" + it.grep{it.trim().startsWith("//") == false}
.grep{
if(it.trim().contains("(*")){
multiLineComment = true
@kyonmm
kyonmm / init.el
Created April 22, 2013 01:42
required skk 他はM-x list-packageで導入する。
(when (eq window-system 'mac)
(add-hook 'window-setup-hook
(lambda ()
;; (setq mac-autohide-menubar-on-maximize t)
(set-frame-parameter nil 'fullscreen 'fullboth)
)))
(defun mac-toggle-max-window ()
(interactive)
/**
パラメータの列挙と制約を書けば、組み合わせをするライブラリ書いた。
したみたいな感じで使います。
一番下のcombination(parameter, constraints)ってするとテストケースが入ったMapが返ってくる感じです。
今は全組み合わせから制約を抜いてくるだけなのですが、k-wayの導入をして、
combination(parameter, constraints, order)ってして組み合わせるようにすればすごくテストが効率化できる感じ。
**/
new groovy.swing.SwingBuilder().edt { optionPane().showMessageDialog(null, "Hello World!") }
apply plugin : "groovy"
apply plugin : "idea"
defaultTasks : idea
repositories{
mavaenCentral()
}
dependencies{