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
60
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
74
CodeceptJS Workshop
davert
1
140
Designing Tests Architecture That Does Not Suck
davert
1
280
Beyond Testing
davert
1
450
Beyond Testing for DutchPHP
davert
0
300
Особенности тестирования PHP проектов
davert
0
86
BeTesting
davert
1
130
Other Decks in Programming
See All in Programming
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
510
AWS Infrastructure as Code の新機能 2025 総まとめ~ SA 4人による怒涛のデモ祭り ~
konokenj
9
2.5k
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
7
1.2k
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
130
Beyond the Basics: Signal Forms
manfredsteyer
PRO
0
100
NOT A HOTEL - 建築や人と融合し、自由を創り出すソフトウェア
not_a_hokuts
2
480
Rubyと楽しいをつくる / Creating joy with Ruby
chobishiba
0
200
AIプロダクト時代のQAエンジニアに求められること
imtnd
1
500
猫の手も借りたい!ので AIエージェント猫を作って社内に放した話 Claude Code × Container Lambda の Slack Bot "DevNeko"
naramomi7
0
220
文字コードの話
qnighy
43
16k
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
490
CSC307 Lecture 09
javiergs
PRO
1
850
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
80
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
620
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
280
Deep Space Network (abreviated)
tonyrice
0
79
Large-scale JavaScript Application Architecture
addyosmani
515
110k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
450
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
110
Navigating Team Friction
lara
192
16k
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