SlideShare a Scribd company logo
1 of 11
Download to read offline
TestCode Refactoring
using ExternalResource
『JUnit実践入門』写経・実践会 in 横浜 #3




@sue445
自己紹介

@sue445
● drecomのRailsエンジニア
● JUnit実践入門の(一応)レビュアー
● AZusaar!!とか作ってます
● TDDマニア
● 最近のマイブームはJenkins
基本的なテストケース
setUp/tearDownを抽出
スーパークラスを作る
スーパークラス、ダメ。ゼッタイ。
スーパークラス、ダメ。ゼッタイ。

● setUpとtearDownをお手軽に共通化できるの
  は便利
● サブクラス以外からの再利用が困難
● サブクラスで知らずにsetUpとtearDownを上書
  きする可能性がある。(finalをつけてれば一応
  防げる)
● 「継承よりもコンポジションを選ぶ(by. Effective
  Java)」ってあるので安易に継承に頼るのはよろ
  しくない
ExternalResourceを使う
Q. スーパークラスに依存してる時
A. ExternalResourceから呼べばおk
おまけ




https://github.
com/sue445/s3tiger/tree/master/src/main/java/net/sue4
45/s3tiger/matcher

More Related Content

More from Go Sueyoshi (a.k.a sue445)

itamae + Serverspecで テスト駆動インフラやってみた #shibuyarb
itamae + Serverspecで テスト駆動インフラやってみた #shibuyarbitamae + Serverspecで テスト駆動インフラやってみた #shibuyarb
itamae + Serverspecで テスト駆動インフラやってみた #shibuyarbGo Sueyoshi (a.k.a sue445)
 
サザエ実況を支える技術 #sst_history
サザエ実況を支える技術 #sst_historyサザエ実況を支える技術 #sst_history
サザエ実況を支える技術 #sst_historyGo Sueyoshi (a.k.a sue445)
 
Paraductをエクストリームリリースします #428rk01
Paraductをエクストリームリリースします #428rk01Paraductをエクストリームリリースします #428rk01
Paraductをエクストリームリリースします #428rk01Go Sueyoshi (a.k.a sue445)
 
GemoireというYARDホスティングアプリを作った #shibuyarb
GemoireというYARDホスティングアプリを作った #shibuyarbGemoireというYARDホスティングアプリを作った #shibuyarb
GemoireというYARDホスティングアプリを作った #shibuyarbGo Sueyoshi (a.k.a sue445)
 
Githubエコシステムを活用したイマドキの趣味開発
Githubエコシステムを活用したイマドキの趣味開発Githubエコシステムを活用したイマドキの趣味開発
Githubエコシステムを活用したイマドキの趣味開発Go Sueyoshi (a.k.a sue445)
 
プリキュアのRuby実装の紹介 #RubyHiroba
プリキュアのRuby実装の紹介 #RubyHirobaプリキュアのRuby実装の紹介 #RubyHiroba
プリキュアのRuby実装の紹介 #RubyHirobaGo Sueyoshi (a.k.a sue445)
 
プリキュアハッカソン2 参加者アンケート集計結果 #cure_hack
プリキュアハッカソン2 参加者アンケート集計結果 #cure_hackプリキュアハッカソン2 参加者アンケート集計結果 #cure_hack
プリキュアハッカソン2 参加者アンケート集計結果 #cure_hackGo Sueyoshi (a.k.a sue445)
 
Resemaraを支えた技術 フライングゲットガチャの舞台裏 #ksgstudy #ドリコム
Resemaraを支えた技術 フライングゲットガチャの舞台裏 #ksgstudy #ドリコムResemaraを支えた技術 フライングゲットガチャの舞台裏 #ksgstudy #ドリコム
Resemaraを支えた技術 フライングゲットガチャの舞台裏 #ksgstudy #ドリコムGo Sueyoshi (a.k.a sue445)
 
Rubyでプリキュアを作った #cure_advent #shibuyarb
Rubyでプリキュアを作った #cure_advent #shibuyarbRubyでプリキュアを作った #cure_advent #shibuyarb
Rubyでプリキュアを作った #cure_advent #shibuyarbGo Sueyoshi (a.k.a sue445)
 

More from Go Sueyoshi (a.k.a sue445) (20)

itamae + Serverspecで テスト駆動インフラやってみた #shibuyarb
itamae + Serverspecで テスト駆動インフラやってみた #shibuyarbitamae + Serverspecで テスト駆動インフラやってみた #shibuyarb
itamae + Serverspecで テスト駆動インフラやってみた #shibuyarb
 
社内テストファースト勉強会
社内テストファースト勉強会社内テストファースト勉強会
社内テストファースト勉強会
 
サザエ実況を支える技術 #sst_history
サザエ実況を支える技術 #sst_historyサザエ実況を支える技術 #sst_history
サザエ実況を支える技術 #sst_history
 
プリキュアのRuby実装の紹介 #tqrk08
プリキュアのRuby実装の紹介 #tqrk08プリキュアのRuby実装の紹介 #tqrk08
プリキュアのRuby実装の紹介 #tqrk08
 
Paraductをエクストリームリリースします #428rk01
Paraductをエクストリームリリースします #428rk01Paraductをエクストリームリリースします #428rk01
Paraductをエクストリームリリースします #428rk01
 
GemoireというYARDホスティングアプリを作った #shibuyarb
GemoireというYARDホスティングアプリを作った #shibuyarbGemoireというYARDホスティングアプリを作った #shibuyarb
GemoireというYARDホスティングアプリを作った #shibuyarb
 
Githubエコシステムを活用したイマドキの趣味開発
Githubエコシステムを活用したイマドキの趣味開発Githubエコシステムを活用したイマドキの趣味開発
Githubエコシステムを活用したイマドキの趣味開発
 
プリキュアのRuby実装の紹介 #RubyHiroba
プリキュアのRuby実装の紹介 #RubyHirobaプリキュアのRuby実装の紹介 #RubyHiroba
プリキュアのRuby実装の紹介 #RubyHiroba
 
プリキュアハッカソン2 参加者アンケート集計結果 #cure_hack
プリキュアハッカソン2 参加者アンケート集計結果 #cure_hackプリキュアハッカソン2 参加者アンケート集計結果 #cure_hack
プリキュアハッカソン2 参加者アンケート集計結果 #cure_hack
 
Resemaraを支えた技術 フライングゲットガチャの舞台裏 #ksgstudy #ドリコム
Resemaraを支えた技術 フライングゲットガチャの舞台裏 #ksgstudy #ドリコムResemaraを支えた技術 フライングゲットガチャの舞台裏 #ksgstudy #ドリコム
Resemaraを支えた技術 フライングゲットガチャの舞台裏 #ksgstudy #ドリコム
 
Rubyでプリキュアを作った #cure_advent #shibuyarb
Rubyでプリキュアを作った #cure_advent #shibuyarbRubyでプリキュアを作った #cure_advent #shibuyarb
Rubyでプリキュアを作った #cure_advent #shibuyarb
 
JavaScript TDD紹介 #agilesamurai
JavaScript TDD紹介 #agilesamuraiJavaScript TDD紹介 #agilesamurai
JavaScript TDD紹介 #agilesamurai
 
First step of Rails Contribute‎ #shibuyarb
First step of Rails Contribute‎ #shibuyarbFirst step of Rails Contribute‎ #shibuyarb
First step of Rails Contribute‎ #shibuyarb
 
勉強会を始めるまで #java_ja
勉強会を始めるまで #java_ja勉強会を始めるまで #java_ja
勉強会を始めるまで #java_ja
 
RSpec Performance Turning
RSpec Performance TurningRSpec Performance Turning
RSpec Performance Turning
 
アニメ実況実践入門
アニメ実況実践入門アニメ実況実践入門
アニメ実況実践入門
 
技術書へのいざない
技術書へのいざない技術書へのいざない
技術書へのいざない
 
ドリコムJenkins勉強会資料
ドリコムJenkins勉強会資料ドリコムJenkins勉強会資料
ドリコムJenkins勉強会資料
 
Sue445 Style TDD #atest_hack
Sue445 Style TDD #atest_hackSue445 Style TDD #atest_hack
Sue445 Style TDD #atest_hack
 
AZusaar!でのappengine活用事例 #ajn19
AZusaar!でのappengine活用事例 #ajn19AZusaar!でのappengine活用事例 #ajn19
AZusaar!でのappengine活用事例 #ajn19
 

Recently uploaded

論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)Hiroki Ichikura
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 

Recently uploaded (10)

論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 

TestCode Refactoring Using ExternalResource #junitbook