Upload
takayuki-konishi
View
2.395
Download
3
Embed Size (px)
Citation preview
Arquillianと AS7によるインテグレーションテスト
+
自己紹介
• 小西 高之• JBossサポートエンジニア
– twitter: @leather_sole– hatena: id:travelershouse
今日はテストの話をします
時間の感覚について
TEST DESIGN
IMPLEMENTATION
経験
• 前職–テスト駆動開発( TDD)のトレーニング–ビジネスロジックのユニットテスト
• よくあった質問
Q:ビジネスロジックのテストもいいけど、 DBやネットワークテストの自動化はどうやればいいんですか?
A:とりあえずはビジネスロジックのテストから習得しましょう ( キリッ
答えになってない…
インテグレーションテストの自動化
• 作成が大変–テスト作成に必要なスキル–テスト結果の収集は?
• 実行に時間がかかる–ビルド、サーバ起動、デプロイ…– Unit Testの目標は” 10秒以内”
• テストコードが脆い– UIの変更– DBの変更、ネットワーク遅延 etc..
Unit Test Integration Test System Test
テストコードの脆弱性 ★★★★★ ★★ ★
テスト作成容易性 ★★★★★ ★★ ★
バグ調査容易性 ★★★★★ ★★★ ★
テスト実行時間 ★★★★★ ★★★ ★
実環境との差 ★ ★★★★ ★★★★★
※発表者の主観です
そこで…
• http://arquillian.org/
• The Extendable Enterprise Test Platform
or
• A container-oriented testing platform
or
• An integration testing framework for Containers
is ...
http://www.java.com/en/dukeschoice/
Andrew Lee Rubinger
http://www.java.com/en/dukeschoice/
Aslak Knutsen
http://www.java.com/en/dukeschoice/
Dan Allen
http://www.java.com/en/dukeschoice/
20
DEMO
Container management
• Embedded– Same JVM as test runner– Lifecycle controlled by Arquillian
• Remote– Separete JVM from test runner– Arquillian connects to running container– Tests executed over remote protocol
• Managed– Remote with lifecycle management
22
Managed mode
Arquillian class(extends BlockJUnit4ClassRunner)
23
test.war
arquillian service
boot
Managed mode
24
Managed mode
run test
25
shutdown
Managed mode
undeploy
correct result
26
Managed mode
result
Supported containers
WAS
WebLogic
https://docs.jboss.org/author/display/ARQ/Complete+Container+Reference
28
DEMO
29
●速度測定●コンテナの使い分け
まとめ
• Arquillianならインテグレーションテストが簡単に!
• Arquillian + JBoss AS7ならさらに高速!• Jenkins CIと組み合わせると Continuous
Integration Testが簡単に!
Unit Test Integration Test System Test
テストコードの脆弱性 ☆☆☆☆☆ ☆☆★★ ☆
テスト作成容易性 ☆☆☆☆☆ ☆☆★★ ☆
バグ調査容易性 ☆☆☆☆☆ ☆☆☆★ ☆
テスト実行時間 ☆☆☆☆☆ ☆☆☆ ☆
実環境との差 ☆ ☆☆☆☆ ☆☆☆☆☆
※あくまでも発表者の主観です
Reference• Arquillian - JBoss Community
http://www.jboss.org/arquillian
• Shrinkwrap - JBoss Communityhttp://www.jboss.org/shrinkwrap/
• Jboss AS 7.0.2 Quickstarts (includes kitchensink)http://download.jboss.org/jbossas/7.0/jboss-as-7.0.2.Final/jboss-as-quickstarts-7.0.2.CR1-dist.zip
• Real Java Enterprise Testinghttp://slidesha.re/q06oXs
• Throwing complexity over the wall: Rapid development for enterprise Javahttp://slidesha.re/vl8Hkw
• JUnithttp://junit.org/
• Githttp://git-scm.com/
• Jenkins CIhttp://jenkins-ci.org/
• JBoss Toolshttp://www.jboss.org/tools
• Arquillian - Alien Species Wiki - Aliens, UFOs, Space alienshttp://aliens.wikia.com/wiki/Arquillian