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
E2E Test Tips
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
はない
August 28, 2016
Technology
180
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
E2E Test Tips
Symfony Meetup #14資料
はない
August 28, 2016
Transcript
20 slides
&&ςετ5JQT !IBOBIJSP@B[F
ͳ·͑ɿՖҪɹߦ UXJUUFSɿ!IBOBIJSP@B[F ॴଐɿIJUPNFEJB 4ZNGPOZྺɿ̍ 99
継続的デリバリー p129 技術視点 ビジネス視点 支 援 評 価 機能の受け入れ テスト ユニットテスト
インテグレーションテスト システムテスト ショーケース(デモなど) ユーザビリティテスト 探索的テスト 非機能の受け入れテスト (キャパシティ/セキュリティなど) リグレッション テスト 前回の復習
「同じ機能に対して手動テストを2回以上 行っていることに気づいたら、 その機能がこの先変更されるかどうか 確かめてみる。」 変更がなさそうなら自動化する。 よく変更されるなら自動化から外す。 継続的デリバリー p139-140 前回の復習
None
http://codeception.com/ https://www.browserstack.com/
"require": { "phpunit/phpunit": "^4.7", "facebook/webdriver": "^1.0" }, http://qiita.com/imunew/items/8806cd68a401c6975d44
・PHPUnit ・codecept ・Phantomjs
$url = 'http://'. self::BROWSERSTACK_USER. ':'. self::BROWSERSTACK_KEY. '@hub.browserstack.com/wd/hub'; return RemoteWebDriver::create($url, [
'browser' => "Chrome", 'browser_version' => "49.0", 'os' => "Windows", 'os_version' => "7", 'browserstack.debug' => "true", 'acceptSslCerts' => "true” ]); https://www.browserstack.com/automate/php
modules: enabled: - WebDriver: url: ‘https://hogehoge.com' browser: chrome - \Helper\Acceptance
Tips1 操作対象の項目にidを振って幸せになる
$I->fillField('//*[@id="main"]/div/div[2]/div/div[2]/div/input'); $textBox = $this->webDriver- >findElement(WebDriverBy::cssSelector('tbody input:nth- child(1)')); $textBox->sendKeys(’hogehoge'); idがないと、「cssセレクタをブラウザのコンソールで確認->貼付」の 繰り返しになり、時間がかかってテストコードを書くのが辛くなってく
る。 codeceptionのXPath指定はかなり便利。
Tips2 テストで確認する範囲を絞る
・複数の画面にまたがるテスト ・成功/失敗をいっぺんに確認するテスト は コード量・実行時間が増えて大変です。
Tips3 取得したスクリーショットを連結して 1枚にする
// about taking screenshots protected function concatFile($domain) { // saveScreenshot時に保存したファイルパスを取得
if(!empty($this->concatFiles)){ $now = new DateTime(); // 連結するベースになる画像の生成 $baseImg = imagecreatetruecolor(AbstractWebDriverTestCase::screenshotWidth, AbstractWebDriverTestCase::screenshotHeight*count($this- >concatFiles)); // ベースイメージにスクリーンショットを貼り付け for($i=0;$i<count($this->concatFiles);$i++){ $screenShot = imagecreatefrompng($this->concatFiles[$i]); imageCopy($baseImg, $screenShot, 0, AbstractWebDriverTestCase::screenshotHeight*$i, 0, 0, AbstractWebDriverTestCase::screenshotWidth, AbstractWebDriverTestCase::screenshotHeight); } // 連結した画像の保存 imagepng($baseImg, AbstractWebDriverTestCase::fileSavePath.$now->format('Ymd').'/'.$domain.'.png'); imagedestroy($baseImg); } // 個別のスクリーンショットは削除 for($i=0;$i<count($this->concatFiles);$i++){ if(file_exists($this->concatFiles[$i])){ unlink($this->concatFiles[$i]); } } // ループする時に前回実行時の情報が残ってしまうので、削除済みの情報を削除 $this->concatFiles = []; }
実行結果がvideoになって便利!
Tips4 あんなことやこんなことしたい
https://github.com/facebook/php-webdriver/issues http://codeception.com/docs/03-AcceptanceTests http://piccagliani.github.io/Codeception.docs.ja_JP/ index.html issuesに「こんなことしたいんだけど」->「こうすればできるよ」が豊富。 使い始めるとdocumentationより頻繁に見てる気がする。 日本語documentがあって安心。
)BWFBOJDF&&5FTU-JGF
More Decks by はない
See All by はない
2018年目標を達成できなかった私が 今年こそ達成するためにしていること
hanahiroaze
3
550
組み合わせテストを簡単にするgemを作った話
hanahiroaze
0
280
MySQLとデッドロックの話
hanahiroaze
1
1.4k
ここが変だよ。このテスト〜テストケース爆発と戦う〜
hanahiroaze
1
1.7k
Symfony Best Practiceを読もう!(ついでに翻訳した話)
hanahiroaze
2
960
テストことはじめ
hanahiroaze
0
530
Symfony2のi18n対応
hanahiroaze
0
860
開発合宿に行ってきました
hanahiroaze
0
160
GitHubよちよち会#3
hanahiroaze
0
190
Other Decks in Technology
See All in Technology
閉域網でのAPI公開の選択肢全部比較!
takano0131
4
560
CloudTrail を推したい
kazzpapa3
1
140
業務の傍らで進める改善ループエンジニアリング
bengo4com
1
190
Claude Codeで新規事業を伸ばせるか? Zennの試行錯誤の記録
wadayusuke
2
240
信頼性を犠牲にせず、PR マージからデプロイまで人の介入を完全にゼロにするまでの道のり
knwoop
0
260
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
17
120k
属人化したISMS運用をGitHubとAIで仕組み化した1年間の記録
sioncojp
4
2.8k
小さなエージェントから始めてみよう!実践コンテキストエンジニアリング
iwamot
PRO
0
130
AIネイティブ組織の作り方。1人のPOとAIから始める、自社での実験
ama_ch
2
1.2k
AI時代における医療情報システムのセキュリティ / Security of Healthcare IT Systems in the AI Era
henryofficial
0
190
人の努力に頼らないセキュリティをエンジニアリングする在り方 / An approach to engineering security that does not rely on human effort
carta_engineering
0
220
gradle-best-practices 使ってみた
mikanichinose
0
160
Featured
See All Featured
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Docker and Python
trallard
47
4.3k
WCS-LA-2024
lcolladotor
0
1k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Claude Code のすすめ
schroneko
67
230k
Paper Plane (Part 1)
katiecoart
PRO
3
12k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
460
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
540
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.8k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
380