spec et test agile sur mobile @airfrance #at lille & cocoaheads tls
DESCRIPTION
TRANSCRIPT
specification & testavec Calabash / Cucumber
ce slide a été testémais n’est pas présentable
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)
#SbE
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
#BDD
tests compréhensible par tout le monde
faciles à écrire et à maintenir#BDD
déclaration comportementale plutot que UI
Spécification par l’exemple
specify help to design no regression tests learn
• 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)
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!
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"
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!
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!
exemple...
ça demande une personne à 100%