Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

23
specification & test avec Calabash / Cucumber

description

 

Transcript of Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

Page 1: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

specification & testavec Calabash / Cucumber

Page 2: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

ce slide a été testémais n’est pas présentable

Page 3: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

Spec et Test agile sur un projet Mobile @airfrance

• au démarrage : une story qui décoiffe (tableau excel inside)

• du destop

• et un peu de ruby ... très attirant

• quelques mois plus tard : demo de la même story (avec dance du slip)

Page 4: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls
Page 5: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls
Page 6: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

#SbE

Page 7: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

les tests deviennent une responsabilité collective

les tests sont les spécifications

les tests sont automatisés

chaque modification est facilement testable

test en continue en IC

#SbE

Page 8: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

#BDD

Page 9: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

tests compréhensible par tout le monde

faciles à écrire et à maintenir#BDD

déclaration comportementale plutot que UI

Spécification par l’exemple

Page 10: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

specify help to design no regression tests learn

Page 11: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

• Cucumber (cukes.info)!

Le standard sur les tests agiles BDD (behavior Driven Development)!

Open source, free et très forte communauté!

• Calabash (calaba.sh)!

Permet cucumber sur mobile iOS et Android!

Open Source, free et forte communauté!

Lien avec des service pro, ex: tests sur le cloud!

(http://xamarin.com/test-cloud)

Page 12: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls
Page 13: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

good

Feature:(Comments(In(order(to(contribute(to(the(discussion(As(a(reader(I(want(to(be(able(to(add(a(comment(

Scenario:(User(not(logged(in((

Given(I(am(not(logged(in((

When(I(go(to(comment(on(a(submission((

Then(I(should(be(prompted(to(log(in!

Page 14: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

not goodScenario:!User!logged!in,!but!cancels!comment!form!!

Given!the!app!is!running!When!I!touch!"Profile"!!

Then!I!wait!to!see!"Login"!!

Then!I!fill!in!“Username”!with!"my_username"!!

Then!I!touch!“Password”!!

Then!I!fill!in!“Password”!with!"my_password"!!

Then!I!touch!done!!

Then!I!wait!to!see!"Logout"!!

Then!I!touch!"Home"!!

Then!I!touch!list!item!number!1!!

Then!I!touch!"reply"!!

Then!I!touch!"Cancel"!!

Then!I!should!see!"Submission"

Page 15: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls
Page 16: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

predefine stepsThen!I!touch!"accLabel"!

Then!I!touch!the!"login"!button!

Then!I!touch!button!number!1!

Then!I!touch!the!"placeholder"!input!field!

Then!I!touch!list!item!number!1!

Then!I!toggle!the!switch!

Then!I!toggle!the!"accLabel"!switch!

Then!I!touch!done!

Then!I!touch!search!

Then!I!touch!the!user!location!

Then!I!touch!on!screen!100!from!the!left!and!250!from!the!top!

Then!I!enter!"text!to!write"!into!the!"placeholder"!input!field!

Then!I!fill!in!"placeholder"!with!"text!to!write"!

Then!I!enter!"text"!into!input!field!number!1!

Then!I!clear!"placeholder"!

Then!I!wait!to!see!"text!or!label"!

Then!I!wait!until!I!don't!see!"text!or!label"!

Then!I!wait!for!the!"login"!button!to!appear!

Then!I!wait!to!see!a!navigation!bar!titled!"title"!

Then!I!wait!for!the!"label"!input!field!

Then!I!wait!for!2!input!fields!

Then!I!wait!

!

Then!I!go!back!

Then!I!swipe!left!

Then!I!swipe!left!on!number!2!

Then!I!swipe!left!on!number!2!at!x!20!and!y!10!

Then!I!swipe!left!on!"accLabel"!

Then!I!swipe!on!cell!number!2!

Then!I!pinch!to!zoom!in!

Then!I!pinch!to!zoom!in!on!"accLabel"!

Then!I!scroll!down!

Then!I!scroll!down!on!"accLabel"!

Then!I!playback!recording!"mytouch"!

Then!I!rotate!device!left!

Then!I!should!see!"text!or!label"!

Then!I!should!see!a!"login"!button!

Then!I!should!see!text!starting!with!"prefix"!

Then!I!should!see!text!containing!"sub!text"!

Then!I!should!see!text!ending!with!"suffix"!

Then!I!see!2!input!fields!

Then!I!should!see!a!"Username"!input!field!

Then!I!should!not!see!a!"Username"!input!field!

Then!I!should!see!a!map!

Then!I!should!see!the!user!location!

Page 17: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

pourquoi pas un peu de ruby

https://www.google.fr/search?q=ruby

Page 18: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

step definitionGiven(/^I(am(logged(in(as("([^"]*)"$/(do(|username|((

macro(I(touch("Profile"((

if(element_exists("button(marked:Logout")((

sleep(1)((

else((

macro(%Q[I(fill(in(“Username”(with("#{username}"]((

macro(I(touch(“Password”((

macro(I(fill(in(“Password”(with("my_password"((

macro(I(touch(done((

macro(I(wait(to(see("Logout"((

end(

end!

Page 19: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

exemple...

Page 20: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls
Lolo
Page 21: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls
Page 22: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls
Page 23: Spec et test agile sur mobile @airfrance #at lille & cocoaheads tls

ça demande une personne à 100%