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
Dimitris Mitsis - Automated tests with CodeCept...
Search
WordPress Greek Community
November 19, 2016
Programming
0
420
Dimitris Mitsis - Automated tests with CodeCeption - WordCamp Athens 2016
WordPress Greek Community
November 19, 2016
Tweet
Share
More Decks by WordPress Greek Community
See All by WordPress Greek Community
Thanassis Zannias - Flexible WordPress Dev Environment with Docker
wpgr
0
22
Andreas Karavanas - AI Supercharged Landing Pages
wpgr
0
27
Όμορφα, γρήγορα και οικονομικά websites με WordPress
wpgr
0
34
Unlocking creativity - Marilia Darilli
wpgr
0
65
Έλλη Μουχτάρη - Χτίσε το προσωπικό σου brand και απόκτησε τους πελάτες που θες
wpgr
0
51
Ioannis Kastorinis - WooCommerce technical automations in the real world
wpgr
0
67
Christos Paloukas - Cache me if you can, a journey through caching layers in WordPress
wpgr
0
73
Ευάγγελος Πάλλης - Malware Cleanup & Protection
wpgr
0
79
Νίκος Μαυράκης - Κοστολογώντας τη δημιουργικότητα
wpgr
0
64
Other Decks in Programming
See All in Programming
ノーコードからの脱出 -地獄のデスロード- / Escape from Base44
keisuke69
0
680
Claude Code on the Web を超える!? Codex Cloud の実践テク5選
sunagaku
0
490
高単価案件で働くための心構え
nullnull
0
110
オフライン対応!Flutterアプリに全文検索エンジンを実装する @FlutterKaigi2025
itsmedreamwalker
1
170
JEP 496 と JEP 497 から学ぶ耐量子計算機暗号入門 / Learning Post-Quantum Crypto Basics from JEP 496 & 497
mackey0225
1
160
業務でAIを使いたい話
hnw
0
260
SidekiqでAIに商品説明を生成させてみた
akinko_0915
0
130
Dive into Triton Internals
appleparan
0
480
なぜ強調表示できず ** が表示されるのか — Perlで始まったMarkdownの歴史と日本語文書における課題
kwahiro
9
5.1k
Temporal Knowledge Graphで作る! 時間変化するナレッジを扱うAI Agentの世界
po3rin
5
1.3k
Swift Concurrency 年表クイズ
omochi
3
230
Blazing Fast UI Development with Compose Hot Reload (Bangladesh KUG, October 2025)
zsmb
2
500
Featured
See All Featured
Unsuck your backbone
ammeep
671
58k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
A better future with KSS
kneath
239
18k
How GitHub (no longer) Works
holman
315
140k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.8k
Fireside Chat
paigeccino
41
3.7k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Facilitating Awesome Meetings
lara
57
6.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Transcript
#wcAth2016 Δημήτρης Μήτσης Αυτοματοποιημένα test με το CodeCeption
Δημήτρης Μήτσης WPML DEVELOPMENT • QUALITY ASSURANCE • PERFORMANCE TESTING
AUTOMATED TESTING • Use of special software to compare the
actual output of an application with the one we expect
Manual tests Integration tests Unit Tests
NEEDS FOR AUTOMATED TESTING • Expedite procedure of quality control
• Quick releases • Integration with WordPress • Integration with 3rd party plugins
UNIT-TEST • TEST DRIVEN DEVELOPMENT (TDD) • PHPUnit Unit testing:
tests if specific parts of the application output the expected result for a given input
BENEFITS OF UNIT-TESTS • Enforce coding standards • Full awareness
of the stack-trace Avoid phrases like: “Works but I don’t know why” White-box testing
2 UnitTests – 0 Integration tests
• Avoid regressions (re-appearance of the same bug) • Ensure
that existing functionality remains • Frequency of updates SIMPLE NEEDS FOR AUTOMATED TESTING
UPDATES FOR WP SEO, WC & WP IN 2016
BEST COFFEE OF YOUR WEEK
CODECEPTION • Testing framework for PHP applications • Easy and
simple to use • Modular and extensible • Promotes design patterns
Unit Tester The geek! Knows the application inside- out Functional
Tester The tester who understands the application but has access to the interface too Acceptance Tester The user which can only test what he sees in the screen CODECEPTION Black box testing Grey box testing White box testing Integration tests
INSTALLATION OF CODECEPTION Requirements • Selenium Standalone • WordPress (website)
(locally or in server) • Browser • Composer • Phar αρχείο (executable) Installation
CODECEPTION – BOOTSTRAP $ wget http://codeception.com/codecept.phar $ php codecept.phar bootstrap
None
None
None
None
None
CODECEPTION – MANUAL TEST STEPS • Create a test product
• View product in the front-end • Add product to cart • Continue with checkout
CODECEPTION – GENERATE TEST $ php codecept.phar generate:cept acceptance WooCommerceBasic
/tests/acceptance/WooCommerceBasicCept.php
None
EMPTY CEST $ codeception.com/docs/06-ModulesAndHelpers#hooks
CODECEPTION – BOOTSTRAP
CODECEPTION –
CODECEPTION –
CODECEPTION – $
CODECEPTION –
php codecept.phar run acceptance --steps java -jar selenium-standalone.jar
CODECEPTION – LOCATORS • CSS ID click(“#css-id”) • CSS
CLASS click(“.css-class”) • TEXT click(“Text”) • xPath click(“//div[@xpath]”) Firebug and FirePath are your friends
CODECEPTION & SELENIUM IDE Two Firefox Add-ons • SeleniumIDE •
CodeCeption Formatters
CODECEPTION HELPERS tests/_support/ΑcceptanceTester.php
CODECEPTION Remember to build after editing this file! php codecept.phar
build
CODECEPTION
CODECEPTION – DESIGN PATTERNS Page Objects & Step Objects •
Each PageObject emphasizes only on one page and its elements. • Each StepObject emphasizes on similar recurring steps
CODECEPTION – PAGE OBJECTS • Locators are defined • Common
steps associated to one page are also defined in the PageObejct • They make tests easier to read
CODECEPTION php codecept.phar generate:pageobject EditProductPage
CODECEPTION
CODECEPTION
Q & A
THAT’S IT! HAPPY TESTING TINYURL.COM/
CODECEPTION – LINKS
CODECEPTION – TIPS <a id=”start_now” href=”...” >Link</a> $I->click( “#start_now” );
CODECEPTION – TIPS <div data-slug=”our-plugin” > // => Somewhere in
the DOM.. //div => ...there is a ...<div>... //div[ ] => ...and it has attributes... //div[ @data-slug=’our_plugin’ ]