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 CodeCeption - WordCamp Athens 2016
Search
WordPress Greek Community
November 19, 2016
Programming
0
330
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
Enhancing WordPress and WooCommerce - Case study of ymca.gr
wpgr
0
48
Κατανόηση της καταναλωτικής συμπεριφοράς και διαμόρφωση στρατηγικής
wpgr
0
41
Συνδυαστικές στρατηγικές για Επιτυχημένο E- Commerce, Online Merchandising και Digital Marketing
wpgr
0
55
Ρυθμίσεις & styling μλοκ με χρήση του theme.json
wpgr
0
81
Marketing στην πράξη το 2023
wpgr
1
49
Το Metaverse και πώς σχετίζεται με το WordPress!
wpgr
0
85
Γνωριμία με την ομάδα Training
wpgr
0
20
Στρατηγική SEO content για e-commerce websites
wpgr
1
60
Είμαι Freelancer, πώς να κάνω personal branding
wpgr
0
37
Other Decks in Programming
See All in Programming
大規模マルチテナントを解決するYugabyteDBという選択肢
nnaka2992
1
250
I/O Extended Android in Korea 2024 ~ Whats new in Android development tools
pluu
0
250
リハビリmruby
kishima
1
160
APIのない大学ログインWebサービスをWKWebViewとJavaScriptでアプリ化した話
akidon0000
1
330
ピグパーティにおけるMongoDB CommunityバージョンからAtlasへの移行事例
10969hotaka
0
130
Ruby メモリ管理 プログラミング
megmogmog1965
0
130
小さな開発会社を作った理由
polidog
0
1.9k
最古の関数型言語「Lisp」ことはじめ / lisp_in_kamiyama
uhooi
1
190
はしめてのプログラミングとロボット制御
watawatavoltage
0
290
社内 LT 会を発足し、アウトプット文化を醸成させるために考えたこと・やったこと / Starting internal LT meetings and fostering an output culture
mackey0225
3
120
スクラムマスターって孤独じゃないですか?
yoshitaroyoyo
1
140
しくじり先生 Image Matching Challenge 2024 編
goosehaaan
0
810
Featured
See All Featured
A Tale of Four Properties
chriscoyier
155
22k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
78
15k
Design by the Numbers
sachag
277
18k
Facilitating Awesome Meetings
lara
46
5.8k
Mobile First: as difficult as doing things right
swwweet
219
8.8k
How to name files
jennybc
67
96k
Rebuilding a faster, lazier Slack
samanthasiow
78
8.5k
Code Reviewing Like a Champion
maltzj
517
39k
Producing Creativity
orderedlist
PRO
340
39k
Fantastic passwords and where to find them - at NoRuKo
philnash
42
2.7k
The Cult of Friendly URLs
andyhume
75
5.9k
GraphQLの誤解/rethinking-graphql
sonatard
59
9.6k
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’ ]