ch Com pos er & M i nkExt ens i on Speedi ng up BDD wi t h Subl i m e Text 2 Br ows er Aut om at i on wi t h Sel eni um ATDD wi t h Behat and Sel eni um ANT & HTM L Repor t Gener at i on Vi deo/Li ve Dem o
ent Dis c us s Stor y 2 Stor y 1 Stor y 3 Specification Workshop Dis till Tester Develope rs PM/S M Implement Acceptance Tests Test er Devel oper Demo Executable Spec Automat ion Automat ion
W r i t e Accept ance Tes t Col l abor at i vel y [ Fai l i ng/Undef i ned] I m pl em ent St ep Def i ni t i on t o m ake i t Pas s Tes t Pas s ! ! Aut om at i on Achi eved.
PHP Appl i cat i ons ht t p: //behat . or g/ M i nk i s a web Accept ance Tes t i ng Fr am ewor k f or PHP ht t p: //m i nk. behat . or g/ Com bi nat i on of Behat /M i nk can be us ed f or web accept ance Tes t i ng. M i nk has Sel eni um 1 & Sel eni um 2 Dr i ver s f or br ows er aut om at i on
cover pear . s ym f ony. com $ pear channel - di s cover pear . behat . or g $ pear i ns t al l behat /behat pear i ns t al l behat /m i nk You Ready t o us e Behat /M i nk,
cover pear . s ym f ony. com $ pear channel - di s cover pear . behat . or g $ pear i ns t al l behat /behat pear i ns t al l behat /m i nk You Ready t o us e Behat /M i nk, W AI T. . . . W e got EASI ER OPTI ON ! ! ! ! !
! ! Com pos er i s dependency m anager f or PHP Com pos er al l ow you t o decl ar e l i br ar i es you needed and i ns t al l i t f or you J us t def i ne al l dependenci es i n ' com pos er . j s on' f i l e and you ar e done ! ! So, Let ' s do t hat
"r equi r e": { "behat /behat ": "2. 4@ s t abl e", "behat /m i nk- ext ens i on": "dev- m as t er ", "f abpot /gout t e": "*", "al exandr es al om e/php- s el eni um ": "*", "i ns t acl i ck/php- webdr i ver ": "*" } , "conf i g": { "bi n- di r ": "bi n" } }
f a ul t : c o n t e x t : c l a s s : ' Fe a t ur e Co n t e x t ' e x t e n s i o n s : B e h a t \ M i n k Ex t e n s i o n \ Ex t e n s i o n : b a s e _ur l : ' h t t p : / / s a uc e l a b s . c o m/ ' j a v a s c r i p t _s e s s i o n : ' s e l e n i um2 ' g o ut t e : ~ s e l e n i um2 :
a d c o mp o s e r us i n g c o mma n d $cur l ht t p: //get com pos er . or g/i ns t al l er | php Sh a s h i - M a c B o o k - Pr o : B e h a t D e mo us e r $ c ur l h t t p : / / g e t c o mp o s e r . o r g / i n s t a l l e r | p h p % To t a l % R e c e i v e d % X f e r d A v e r a g e Sp e e d Ti me Ti me Ti me Cur r e n t D l o a d U p l o a d To t a l Sp e n t Le f t Sp e e d 1 0 0 7 6 0 6 1 0 0 7 6 0 6 0 0 5 9 6 3 6 0 - - : - - : - - - - : - - : - - - - : - - : - - 1 6 5 k #! / us r / b i n / e n v p h p A l l s e t t i n g s c o r r e c t f o r us i n g Co mp o s e r D o wn l o a d i n g . . .
$ p h p c o mp o s e r . p h a r i n s t a l l Sh a s h i - M a c B o o k - Pr o : B e h a t D e mo us e r $ p h p c o mp o s e r . p h a r up d a t e U p d a t i n g d e p e n d e n c i e s - In s t a l l i n g g uz z l e / g uz z l e ( v 2 . 6 . 3 ) D o wn l o a d i n g : 1 0 0 % - In s t a l l i n g s y mf o n y / y a ml ( d e v - ma s t e r ) Cl o n i n g 4 9 a d 5 0 0 4 4 8 c 1 7 a 4 b 5 1 5 c 8 f 5 6 7 d b b 5 4 0 a f 3 c f 4 1 e f - In s t a l l i n g s y mf o n y / t r a n s l a t i o n ( d e v - ma s t e r ) [ So o n … . . . . . . . . . . . ]
i ni t Sh a s h i - M a c B o o k - Pr o : B e h a t D e mo us e r $ . / b i n / b e h a t - - i n i t +d f e a t ur e s - p l a c e y o ur * . f e a t ur e f i l e s h e r e +d f e a t ur e s / b o o t s t r a p - p l a c e b o o t s t r a p s c r i p t s a n d s t a t i c f i l e s h e r e +f f e a t ur e s / b o o t s t r a p / Fe a t ur e Co n t e x t . p h p - p l a c e y o ur f e a t ur e r e l a t e d c o d e h e r e [ You wi l l See Behat cr eat ed ' f eat ur es ' and ' boot s t r ap' di r ect or y f or you]
t e d ' f e a t ur e s ' d i r e c t o r y Cr e a t e d ' b o o t s t r a p ' d i r e c t o r y a n d ' Fe a t ur e Co n t e x t . p h p ' f i l e wh e r e we wi l l i mp l e me n t s t e p d e f i n i t i o n s .
' Feat ur eCont ext ' cl as s t o' Behat \M i nkExt ens i on\Cont ext \M i n kCont ext So, W e ar e us i ng ' M i nkExt ens i on' whi ch aut om at i cal l y cr eat e M i nk i ns t ance. W e us ed M i nk API ' s t o aut om at ed Br ows er act i ons . ( ht t p: //m i nk. behat . or g/api /)
eat ur e I n or der t o [ add f eat ur e] As a [ r ol e] I want [ f eat ut e] Scenar i o: Fi r s t Scenar i o Gi ven [ Cont ext ] W hen [ Act i on] Then [ Out Com e]
I n or der t o s ear ch bl ogs As a s auce us er I need s ee bl ogs @ j avas cr i pt Scenario: Search Behat Blogs Given I am on "/blog" When I fill in "s" with "behat" And I press "Search" Then I should see "Adding Sauce To Behat" [ Th i s f i l e s h o ul d b e i n / f e a t ur e s d i r e c t o r y . ]
ppet s W i l l em s en Chr i s t ophe Gi t Hub : kwat t r o - I nt r anet appz devel oper f or t he Bel gi an Def ens e, BDD pr act i t i oner . [ Sym f ony] Twi t t er : @ i kwat t r o Gi t Hub: ht t ps : //gi t hub. com /kwat t r o/s ubl i m e - behat - s ni ppet s
s houl d I f i nd l ocat or s bef or e I m pl em ent at i on? Don' t wor r y, W r i t e hi gh l evel t es t s and Behat & M i nk API ' s wi l l hel p you t o i m pl em ent St ep def l at er ( af t er i m pl em ent at i on)
I n or der t o i m pl em ent ATDD As a QA I need t o wr i t e accept ance t es t s f i r s t @ j avas cr i pt @ at dd Scenar i o: Sear chi ng Gi ven I am on bl ogs page W hen I s ear ch f or "c h i p s " Then I s houl d s ee "N o Po s t s "
@W h e n / ^I s e a r c h f o r " ( [ ^" ] * ) " $ / * / publ i c f unct i on i Sear chFor ( $ k e y ) { $ t h i s - >f i l l Fi e l d ( " s " , $ k e y ) ; $ t h i s - >p r e s s B ut t o n ( " Se a r c h " ) ; } / * * * @G i v e n / ^I a m o n b l o g s p a g e $ / * / publ i c f unct i on i Am OnBl ogs Page( ) { $ t h i s - >v i s i t ( " / b l o g " ) ; }
L r epor t s $ . /bi n/behat - f ht m l - - out r epor t . ht m l You wi l l s ee ' r epor t . ht m l ' gener at ed whi ch l ooks awes om e i n br ows er ! !
r e a t e d ' r e p o r t ' d i r e c t o r y t o s a v e t e s t r e p o r t o f t h e l a t e s t b ui l d R e p o r t wi l l g e n e r a t e i n h t ml f o r ma t i n t h e ' r e p o r t / r e p o r t . h t ml ' f i l e .
h a t . o r g / h t t p: / / mi n k . b e h a t . o r g / h t t ps : / / g i t h ub . c o m/ Sh a s h i k a n t 8 6 / B e h a t D e mo h t t ps : / / g i t h ub . c o m/ k wa t t r o / s ub l i me - b e h a t - s n i ppe t s h t t p: / / e v e r z e t . c o m/