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
54
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
100
DESIGN DECISIONS FOR PERFECT JS E2E TESTING FRAMEWORK
davert
0
700
Bugira
davert
0
71
CodeceptJS Workshop
davert
1
130
Designing Tests Architecture That Does Not Suck
davert
1
240
Beyond Testing
davert
1
430
Beyond Testing for DutchPHP
davert
0
270
Особенности тестирования PHP проектов
davert
0
76
BeTesting
davert
1
130
Other Decks in Programming
See All in Programming
顧客の画像データをテラバイト単位で配信する 画像サーバを WebP にした際に起こった課題と その対応策 ~継続的な取り組みを添えて~
takutakahashi
1
150
ご注文の差分はこちらですか? 〜 AWS CDK のいろいろな差分検出と安全なデプロイ
konokenj
3
370
Rails Frontend Evolution: It Was a Setup All Along
skryukov
0
220
生成AI時代のコンポーネントライブラリの作り方
touyou
1
250
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
0
140
AI時代のソフトウェア開発を考える(2025/07版) / Agentic Software Engineering Findy 2025-07 Edition
twada
PRO
94
33k
dbt民主化とLLMによる開発ブースト ~ AI Readyな分析サイクルを目指して ~
yoshyum
3
1.1k
Azure AI Foundryではじめてのマルチエージェントワークフロー
seosoft
0
190
코딩 에이전트 체크리스트: Claude Code ver.
nacyot
0
840
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
2
550
GPUを計算資源として使おう!
primenumber
1
190
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
820
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Six Lessons from altMBA
skipperchong
28
3.9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
Into the Great Unknown - MozCon
thekraken
40
1.9k
Docker and Python
trallard
44
3.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
Site-Speed That Sticks
csswizardry
10
690
Being A Developer After 40
akosma
90
590k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.7k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
510
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
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