33

Integration test with Arquillian and JBoss AS 7

Embed Size (px)

Citation preview

Page 1: Integration test with Arquillian and JBoss AS 7
Page 2: Integration test with Arquillian and JBoss AS 7

Arquillianと AS7によるインテグレーションテスト

+

Page 3: Integration test with Arquillian and JBoss AS 7

自己紹介

• 小西 高之• JBossサポートエンジニア

– twitter: @leather_sole– hatena: id:travelershouse

Page 4: Integration test with Arquillian and JBoss AS 7

今日はテストの話をします

Page 5: Integration test with Arquillian and JBoss AS 7

時間の感覚について

Page 6: Integration test with Arquillian and JBoss AS 7

TEST DESIGN

IMPLEMENTATION

Page 7: Integration test with Arquillian and JBoss AS 7

経験

• 前職–テスト駆動開発( TDD)のトレーニング–ビジネスロジックのユニットテスト

• よくあった質問

Page 8: Integration test with Arquillian and JBoss AS 7

Q:ビジネスロジックのテストもいいけど、 DBやネットワークテストの自動化はどうやればいいんですか?

Page 9: Integration test with Arquillian and JBoss AS 7

A:とりあえずはビジネスロジックのテストから習得しましょう ( キリッ

Page 10: Integration test with Arquillian and JBoss AS 7

答えになってない…

Page 11: Integration test with Arquillian and JBoss AS 7

インテグレーションテストの自動化

• 作成が大変–テスト作成に必要なスキル–テスト結果の収集は?

• 実行に時間がかかる–ビルド、サーバ起動、デプロイ…– Unit Testの目標は” 10秒以内”

• テストコードが脆い– UIの変更– DBの変更、ネットワーク遅延 etc..

Page 12: Integration test with Arquillian and JBoss AS 7

Unit Test Integration Test System Test

テストコードの脆弱性 ★★★★★ ★★ ★

テスト作成容易性 ★★★★★ ★★ ★

バグ調査容易性 ★★★★★ ★★★ ★

テスト実行時間 ★★★★★ ★★★ ★

実環境との差 ★ ★★★★ ★★★★★

※発表者の主観です

Page 13: Integration test with Arquillian and JBoss AS 7

そこで…

Page 14: Integration test with Arquillian and JBoss AS 7

• http://arquillian.org/

Page 15: Integration test with Arquillian and JBoss AS 7

• The Extendable Enterprise Test Platform

or

• A container-oriented testing platform

or

• An integration testing framework for Containers

is ...

Page 16: Integration test with Arquillian and JBoss AS 7

http://www.java.com/en/dukeschoice/

Page 17: Integration test with Arquillian and JBoss AS 7

Andrew Lee Rubinger

http://www.java.com/en/dukeschoice/

Page 18: Integration test with Arquillian and JBoss AS 7

Aslak Knutsen

http://www.java.com/en/dukeschoice/

Page 19: Integration test with Arquillian and JBoss AS 7

Dan Allen

http://www.java.com/en/dukeschoice/

Page 20: Integration test with Arquillian and JBoss AS 7

20

DEMO

Page 21: Integration test with Arquillian and JBoss AS 7

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

Page 22: Integration test with Arquillian and JBoss AS 7

22

Managed mode

Arquillian class(extends BlockJUnit4ClassRunner)

Page 23: Integration test with Arquillian and JBoss AS 7

23

test.war

arquillian service

boot

Managed mode

Page 24: Integration test with Arquillian and JBoss AS 7

24

Managed mode

run test

Page 25: Integration test with Arquillian and JBoss AS 7

25

shutdown

Managed mode

undeploy

correct result

Page 26: Integration test with Arquillian and JBoss AS 7

26

Managed mode

result

Page 27: Integration test with Arquillian and JBoss AS 7

Supported containers

WAS

WebLogic

https://docs.jboss.org/author/display/ARQ/Complete+Container+Reference

Page 28: Integration test with Arquillian and JBoss AS 7

28

DEMO

Page 29: Integration test with Arquillian and JBoss AS 7

29

●速度測定●コンテナの使い分け

Page 30: Integration test with Arquillian and JBoss AS 7

まとめ

• Arquillianならインテグレーションテストが簡単に!

• Arquillian + JBoss AS7ならさらに高速!• Jenkins CIと組み合わせると Continuous

Integration Testが簡単に!

Page 31: Integration test with Arquillian and JBoss AS 7

Unit Test Integration Test System Test

テストコードの脆弱性 ☆☆☆☆☆ ☆☆★★ ☆

テスト作成容易性 ☆☆☆☆☆ ☆☆★★ ☆

バグ調査容易性 ☆☆☆☆☆ ☆☆☆★ ☆

テスト実行時間 ☆☆☆☆☆ ☆☆☆ ☆

実環境との差 ☆ ☆☆☆☆ ☆☆☆☆☆

※あくまでも発表者の主観です

Page 32: Integration test with Arquillian and JBoss AS 7

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

Page 33: Integration test with Arquillian and JBoss AS 7