Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
SelenideよるDSL風E2Eテスト基盤開発の実例/Example_of_E2E_Auto...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
SHIMANE, Yoshikazu
March 07, 2017
Programming
1.1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SelenideよるDSL風E2Eテスト基盤開発の実例/Example_of_E2E_Automation_Test_Architecture_By_Selenide
2017年3月7日 Test Engineers Meetup #2
SelenideによるDSL風E2Eテスト基盤開発の実例
SHIMANE, Yoshikazu
March 07, 2017
More Decks by SHIMANE, Yoshikazu
See All by SHIMANE, Yoshikazu
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
1
980
ソフトウェア開発温故知新 古典で紐解く、ソフトウェア開発の課題 / Software_Development:Learning_from_the_Past
shimashima35
0
98
入り口から考えるソフトウェアテストエンジニアのキャリア / Thinking_About_a_Software_Test Engineer's_Career_from_the_Starting_Point
shimashima35
0
2k
テスト技法を使ったテストケースの表現方法/How to express test cases using test techniques
shimashima35
0
1.6k
VSTePのテスト観点出しで失敗した事例についての紹介/Failure case of test viewpoint derivation
shimashima35
0
930
組織横断部門におけるバグ数可視化の全社導入の事例/Example_of_company-wide_bug_number_visualization in_cross-organizational_departments
shimashima35
1
420
JaSST Tokyo実行委員のお仕事/Job of JaSST executive committee
shimashima35
0
1.1k
What is “Quality” ?
shimashima35
0
1.1k
品質"実質"無料キャンペーン始めます / Start_quality_real_free_campaign
shimashima35
2
5.9k
Other Decks in Programming
See All in Programming
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
200
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
380
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
120
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
210
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
190
No More NoSuchMethodError
exoego
1
110
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
1.3k
ChromeでローカルLLM
ryu1013
0
160
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
140
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
190
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
120
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
10
6.9k
Featured
See All Featured
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Google's AI Overviews - The New Search
badams
0
1.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
My Coaching Mixtape
mlcsv
0
360
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
560
The Curious Case for Waylosing
cassininazir
1
580
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Test your architecture with Archunit
thirion
2
2.5k
Transcript
SelenideによるDSL風E2Eテスト基 盤開発の実例 アカウンティング・サース・ジャパン 島根 義和 @shimashima35 https://srad.jp/~shimashima
はじめに • 社内で開発したWebDriver(Selenide)を使ったE2Eテスト基盤の実例を紹介します。 • 基本的にJavaが前提ですが、静的型付けのメリット以外は他言語でも利用可能で す。
注意 • 基本的にQiitaで公開した内容と同じです。 ◦ http://qiita.com/shimashima35/items/6d39be9a4fea05dcc84f
Selenideとは? • JavaのSelenium WebDrvierラッパーライブラリ。 • http://selenide.org/ • WebDriverの実装を抽象化し、UI Testに特化したAPIを提供している。 •
読みやすいAPI。 • IDEによるサポートを意識した作り。
基盤開発の目的 • 高い保守性 • 高い生産性 • 可能であれば仕様策定者が自分でテストをかけるようにする
階層化Page Object Pattern導入 • 一般的なPage Object Patternを拡張 ◦ BasePage ▪
抽象クラス ▪ セレクタのみが記述される ▪ WebDriver/Selenide API依存 ▪ メソッドシグネチャにも Selenideの型が現れる ◦ Page ▪ 具象クラス ▪ 抽象化した画面操作 APIを提供する層 ▪ メソッドシグネチャは Java標準APIの型のみ
階層化Page Object Pattern導入 サンプル
Selenium/Selenideの直接操作の排除 • テストシナリオでSelenium/Selenideの実装を隠蔽する。 ◦ シナリオの注力する ◦ 実装隠蔽による変更耐性向上 ◦ 特別なAPI学習の必要性を排除
全面的な日本語メソッド化 • 税務・会計・給与を対象しているため ◦ 一般的なWeb画面に比べて入力項目が多数 ◦ 似たような名前で且つ業務的に特殊な用語が使われることが多い ◦ 日本語化することで画面の項目とメソッド名とのギャップを埋める •
非プログラマでもテストをかけるように ◦ 心理的障壁をさげる
全面的な日本語メソッド化 サンプル
疑似Builder Patternによるデータ登録 • ユーザ登録などで入力項目が多数になる • シナリオで記述は大変 • 共通メソッド化を行うにしても引数が多い、また入力しなくても良い項目の存在 • Builder
Patternを導入することでわかりやすくする
疑似Builder Patternによるデータ登録 サンプル
Mix-inによる画面共通項目の一元化 • 画面単位の処理はPage Objectで対応 • 画面横断的な処理はどうするか? • Mix-inで対応 • Java8
interface の default method で実現
None
Mix-inによる画面共通項目の一元化 サンプル
画面要素の細かいObject化 • 画面上の項目数が多い & コンテキスト(配置場所)違いで同じ名称が存在している • コンテキストをすべてClass化 (Page Objectのinner class)
• コンテキストへのアクセスはメソッド経由
None
None
疑似的なDSLのために、戻り値をObject化 • Selenideのように、IDEの力を借りるため • 戻り値をObjectにすることでIDEの補完機能が使える
デモ
終わりに • テスト自動化は大変ですが、様々な手法を使うことで苦労を軽減することができま す。 • IDEの力も、可能なかぎり借りましょう。 • 自動化はコストがかかるので、頼り過ぎには注意を。 • 目的をはっきりさせた上で使いましょう。
ご静聴ありがとうございました