Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Dimitris Mitsis - Automated tests with CodeCeption - WordCamp Athens 2016
WordPress Greek Community
November 19, 2016
Programming
0
180
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
Η τέλεια στρατηγική προώθησης ενός WordPress/Woo website - Γιάννης Δεβελέκος
wpgr
0
41
Cookies και άλλες τεχνολογίες στην ιστοσελίδα μου: Τελικά τι μπορώ να χρησιμοποιώ; - Βασίλης Καρκατζούνης
wpgr
0
28
Making the most of WooCommerce - Δημήτριος Σελημίδης
wpgr
0
11
Making WordPress faster and greener - David Hilditch [ΕΝ]
wpgr
0
16
It is not a sprint is a marathon… running your eshop - Ιωάννης Καστορίνης
wpgr
0
10
Scaling WooCommerce - Δημήτρης Χατζημιχαηλίδης
wpgr
0
17
Let’s burst our bubble: projects, products, estimates and forecasts. - Tassos Koutlas
wpgr
0
18
Page Experience road - Fellyph Cintra [ΕΝ]
wpgr
0
13
Building with Patterns: Introduction and next steps - Νίκος Τσεκούρας
wpgr
0
10
Other Decks in Programming
See All in Programming
About Type Syntax Proposal
quramy
1
1.2k
Hapticをカスタマイズしてみよう / ZOZO Tech Talk #6 Customize Haptic
endoumari
0
360
Microsoft Teams の 会議アプリ開発のはじめかた / How to start Microsoft Teams app development
karamem0
0
1.7k
テスト設計技法をなぜ&どのように使うのか体験しよう!
imtnd
0
510
UI State Modeling 어떤게 좋을까?
laco2951
1
240
モデリングの費用対効果
masuda220
PRO
4
960
mrubyを1300円のボードで動かそう
yuuu
0
190
質とスピード(2022春版、質疑応答用資料付き) / Quality and Speed 2022 Spring Edition
twada
PRO
30
19k
Explore Java 17 and beyond
josepaumard
3
670
Composing an API with Kotlin (Kotlin Dev Day 2022)
zsmb
0
300
Micro Frontends with Module Federation: Beyond the Basics @codecrafts2022
manfredsteyer
PRO
0
130
Micro Frontends with Module Federation: Beyond the Basics @jax2022
manfredsteyer
PRO
1
300
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
212
7.5k
GitHub's CSS Performance
jonrohan
1020
410k
Rebuilding a faster, lazier Slack
samanthasiow
62
7.2k
Design by the Numbers
sachag
271
17k
WebSockets: Embracing the real-time Web
robhawkes
57
5k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
349
27k
Adopting Sorbet at Scale
ufuk
63
7.5k
A Philosophy of Restraint
colly
192
14k
Web Components: a chance to create the future
zenorocha
303
40k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
350
21k
Documentation Writing (for coders)
carmenhchung
48
2.5k
Happy Clients
brianwarren
89
5.5k
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’ ]