Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Beyond Testing
Search
Michael Bodnarchuk
September 15, 2015
Programming
0
61
Beyond Testing
Things you should know maintaining stable testing suite
Michael Bodnarchuk
September 15, 2015
Tweet
Share
More Decks by Michael Bodnarchuk
See All by Michael Bodnarchuk
Codeception 3.0: Long Bloody Story
davert
0
110
DESIGN DECISIONS FOR PERFECT JS E2E TESTING FRAMEWORK
davert
0
710
Bugira
davert
0
75
CodeceptJS Workshop
davert
1
140
Designing Tests Architecture That Does Not Suck
davert
1
280
Beyond Testing
davert
1
460
Beyond Testing for DutchPHP
davert
0
300
Особенности тестирования PHP проектов
davert
0
88
BeTesting
davert
1
130
Other Decks in Programming
See All in Programming
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
450
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
150
ふつうのRubyist、ちいさなデバイス、大きな一年 / Ordinary Rubyists, Tiny Devices, Big Year
chobishiba
1
480
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
190
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
110
Windows on Ryzen and I
seosoft
0
320
脱 雰囲気実装!AgentCoreを良い感じにWEBアプリケーションに組み込むために
takuyay0ne
3
290
「やめとこ」がなくなった — 1月にZennを始めて22本書いた AI共創開発のリアル
atani14
0
400
Docコメントで始める簡単ガードレール
keisukeikeda
1
120
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
610
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
500
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
710
Featured
See All Featured
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
130
How Software Deployment tools have changed in the past 20 years
geshan
0
33k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
690
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.4k
Tell your own story through comics
letsgokoyo
1
850
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
150
Designing for humans not robots
tammielis
254
26k
Transcript
Michael Bodnarchuk BEYOND TESTING
WHO AM I • Michael Bodnarchuk @davert • Web-developer from
Kyiv, Ukraine • Lead developer of Codeception testing framework and other OS tools like: Robo, AspectMock, etc
WHAT IS IT ALL ABOUT • What to do when
PHPUnit is installed and first tests are done • What you should know writing a test • Choosing the best tool for testing • Creating test environment
KINDS OF TESTS • Acceptance • Functional • Integration •
Unit
BEST PRACTICES SOME KIND OF
IDEAL TEST ▪Condition (Given) ▪Action (When) ▪Assertion (Then)
HOW TO WRITE TEST • Separate configuration from test •
Do not use hierarchy for testcases (use traits when needed) • Separate test code from support code • Make test simple and verbose
DON'T DO IT THIS WAY move to configuration use traits
IMPLEMENT YOUR OWN ASSERTIONS custom assertions make code more readable
MAKE IT SIMPLER!
WHAT IS HARD TO TEST • Asynchronous stuff • Remote
Services • Real Data
TESTS CRITERIA • Execution Stability ↓ • Stability to Changes
↑ • Speed ↓ • Coverage ↑ • Preciseness ↓ • Readability ↕ Unit => Integration => Functional => Acceptance
PRICE OF A FAULT REGRESSION TESTS
DATA MANAGEMENT HOW TO TEST DB INTERACTION
MANAGING TEST DATA WITH • Fixtures (nelmio/alice) • Dumps •
Factories (thephpleague/factory-muffin)
FACTORY_MUFFIN IN REAL LIFE
DATA CLEANUP STRATEGIES • Manually create/delete data between tests •
Recreate the database between tests • Using transactions – reverting changes with rollback
TOOLS FOR TESTING YOU SHOULD PROBABLY KNOW
PHPUNIT • Standard de-facto • Monolithic framework • Two mocking
engines included (why not 3?) • JUnit, HTML, reports... and codecoverage • And other 100500 sometimes used features
PHPSPEC • TDD framework • Classes are generated from tests
• Dependencies are described through mocking • Does not replace PHPUnit • For development, not for testing
BEHAT • BDD-framework • Ubiquitous language (Gherkin) • Acceptance testing
via Mink (Selenium, Goutte, etc)
CODECEPTION • BDD-style testing framework • Scenario DSL for describing
tests • Over 20 modules to cover the most of possible cases • Testing via Selenium, PhpBrowser, frameworks...
TESTING EMAILS: MAILCATCHER
MAILCATCHER • Ruby application with web interface • SMTP-mock •
Provides REST API for sent emails • API can be used in tests • Alternative in Go - MailHog
TESTING WEB APPLICATIONS • Selenium • PhantomJS • Browser emulation
via HTTP client
USING SELENIUM ON CI SERVER • Selenium Server • Xvfb
– Virtual Framebuffer • Firefox or Chromium
INSTEAD OF CONFIGURING IT MANUALLY docker run -d -p 4444:4444
-e APP_HOST=myapp davert/selenium-env
WHAT IS DOCKER? • Docker is an open platform distributed
apps • Runs and manages isolated Linux containers • Provides GitHub-like infrastructure
PARALLEL TESTING • Tests separation • Jobs isolation
HOW TO PARALLEL TESTS WITH DOCKER • Build container(s) for
test environment • Run container(s) with Docker Compose • Use Jenkins Matrix to run concurrent builds
docker run -i -t -v $WORKSPACE:/project test_container ./runtests.sh $SUITE
CONCLUSIONS • Testing is not just about unit tests •
Tests are code: make them easy to read and maintain • Testing is about tools, environment and infrastructure as well
QUESTIONS? • My name is Michael Bodnarchuk • Twitter: @davert
• GitHub: DavertMik • ….and don't forget to try http://codeception.com