Lisibilité du code produit
SELENIUM :
Selenium est orienté commande :
selenium.Open("/mutuelle-sante/tarif-mutuelle-sante/tarif.aspx");
selenium.Click("//input[@name='reponseCibleDemandeTarif']");
selenium.Type("//input[@name='reponseDateEffetGarantie']", "03/06/2010");
selenium.Click("//input[@name='reponseClient']");
selenium.Click("//input[@name='reponseClient' and @value='15']");
La difficulté principale étant la lecture des sélecteurs qui sont formulés en XPATH.
WATIN :
Watin est orienté modèle :
// Windows
WatiN.Core.IE window = new WatiN.Core.IE();
// Frames
// Model
RadioButton rbn_reponseCibleDemandeTarif_2______ = window.RadioButton(Find.ByName("reponseCibleDemandeTarif"));
TextField txt_reponseDateEffetGarantie = window.TextField(Find.ByName("reponseDateEffetGarantie"));
Div div______ = window.Div(Find.ByText("") && Find.ByStyle("") && Find.ByValue("") && Find.ById("") && Find.BySrc("") && Find.ByUrl(""));
// Code
window.GoTo("http://devladeveze/mutuelle-sante/tarif-mutuelle-sante/tarif.aspx");
rbn_reponseCibleDemandeTarif_2______.Checked = true;
txt_reponseDateEffetGarantie.Click();
txt_reponseDateEffetGarantie.AppendText("03divide06divide2010");
div______.Click();
System.Windows.Forms.SendKeys.SendWait("{TAB}");
System.Windows.Forms.SendKeys.SendWait("{DOWN}");
txt_reponseDateEffetGarantie.Click();
txt_reponseDateEffetGarantie.AppendText("home");
Assert.That(window.TextField(Find.ByName("reponse")).GetAttributeValue(""),Is.Equal("03/06/2010"));
* Les noms générés par le recorder sont illisibles
* Les paramètres recherches ne sont pas toujours judicieuses
* Le modèle objet peut être moins lisible pour un non-développeur
* Le code produit par Watin test recorder est propre pour IE
Partager