Am 22.08.2011 09:45, schrieb Mathilde Pellerin:
Hi all,thanks for your answers. So, Ajax can be a problem with tagTester. Ok, so I don't use Ajax response anymore to render my page : public void testStory23_TA21_VerificationInitialisationBoutonsRadio(){ Questionnaire questionnaire = serviceQuestionnaire.findBytitre("Questionnaire pour Femme").get(0); CreationQuestionnairePage creationQuestionnairePage = new CreationQuestionnairePage( new PageParameters("p=2"), questionnaire); tester.startPage(creationQuestionnairePage); tester.assertRenderedPage(CreationQuestionnairePage.class); then, I checked my markup by tester.dumpPage() : <h2>Questionnaires</h2> <p> <a href="#" wicket:id="retourRecapitulatif" id="retourRecapitulatif3" onclick="var wcall=wicketAjaxGet('?wicket:interface=:0:retourRecapitulatif::IBehaviorListener:0:',function() { }.bind(this),function() { }.bind(this), function() {return Wicket.$('retourRecapitulatif3') != null;}.bind(this));return !wcall;">Retour à la liste des questionnaires</a> </p> <h3>Création d'un nouveau questionnaire :</h3> <div> <form wicket:id="formCreationQuestionnaire" method="post" id="formCreationQuestionnaire4" action="?wicket:interface=:0:formCreationQuestionnaire::IFormSubmitListener::" enctype="multipart/form-data"><div style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"><input type="hidden" name="formCreationQuestionnaire4_hf_0" id="formCreationQuestionnaire4_hf_0" /></div> <table> <tr> <td colspan="2" style="border-bottom: none;"><span wicket:id="feedback" id="feedback5"><wicket:panel> </wicket:panel></span> </td> </tr> <tr> <td><h4>Titre du nouveau questionnaire :</h4></td> <td><input type="text" wicket:id="titre" style="width: 100%;" value="Questionnaire pour Femme" name="titre"/> </td> </tr> <tr> <td><h4>Numéro :</h4></td> <td><input type="text" wicket:id="numero" style="width: 100px;" value="Q2" name="numero"/> </td> </tr> <tr> <td><h4>Genre des destinataires :</h4></td> <td> <input type="radio" wicket:id="femme" id="femme6" name="genre" value="radio0" checked="checked" class="wicket-genre7"/> Femme <input type="radio" wicket:id="homme" id="homme8" name="genre" value="radio1" class="wicket-genre7"/> Homme <input type="radio" wicket:id="mixte" id="mixte9" name="genre" value="radio2" class="wicket-genre7"/> Mixte </td> </tr> we can see that radio button with wicket:id="femme" have tag "checked". But in my test : TagTester tagFemme = tester.getTagByWicketId("formCreationQuestionnaire:genre:femme"); TagTester tagHomme = tester.getTagByWicketId("formCreationQuestionnaire:genre:homme"); TagTester tagMixte = tester.getTagByWicketId("formCreationQuestionnaire:genre:mixte"); //tester.debugComponentTrees(); tester.dumpPage(); Assert.assertNotNull(tagFemme); tagFemme is still null. I checked my path for this radio button with tester.debugComponentTrees() : INFO - BaseWicketTester - path formCreationQuestionnaire:genre org.apache.wicket.markup.html.form.RadioGroup [f] INFO - BaseWicketTester - path formCreationQuestionnaire:genre:femme org.apache.wicket.markup.html.form.Radio [f] INFO - BaseWicketTester - path formCreationQuestionnaire:genre:homme org.apache.wicket.markup.html.form.Radio [h] INFO - BaseWicketTester - path formCreationQuestionnaire:genre:mixte org.apache.wicket.markup.html.form.Radio [b] I really don't understand what am I doing wrong...
Where is genre? Try formCreationQuestionnaire:homme . Did that help? Mike --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
