You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk> on 2007/09/17 20:52:19 UTC

Re: Testing wicket 1.3

Hi

I was wondering how I should be testing with wicket. I've created the 
bbcodecomponent, I have a bbcodeLabel. And I would like to write a test 
for that. I can see that I can't use the assertLabel as that just gets 
modelObjectToString, in the bbcodeLabel some formatting are done during 
onComponentTagBody. Is this completely wrong, how should testing be 
done? I can see that the dateLabel uses an approach with converters, 
although im not sure how this are done. But are this more propper?


regards Nino




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Testing wicket 1.3

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
ahh, yeah this are more flexible:)

regards Nino

Frank Bille wrote:
> One thing you also could consider is using the TagTester. Currently you can
> find a tag by using the getTagById and getTagByWicketId. My orignial plan
> was to have several helper methods for finding the html tags you want for
> testing.
>
> http://wicketstuff.org/wicket13doc/org/apache/wicket/util/tester/TagTester.html
>
> Frank
>
>
> On 9/19/07, Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>
> wrote:
>   
>> Hi Kent
>>
>> hmm, while this could be okay. I just fear the possibility that tests
>> may succeed if other components contains foo. This test does not take
>> hierarchy into account..
>>
>> For the simple Bbcodecomponent, it will work as I will be testing it
>> isolated. However if others that are using the component wants to test
>> that the out come are correct, this could be a potential pitfall.
>>
>>
>> regards Nino
>>
>> Kent Tong wrote:
>>     
>>> Nino.Martinez wrote:
>>>
>>>       
>>>> I was wondering how I should be testing with wicket. I've created the
>>>> bbcodecomponent, I have a bbcodeLabel. And I would like to write a test
>>>> for that. I can see that I can't use the assertLabel as that just gets
>>>> modelObjectToString, in the bbcodeLabel some formatting are done during
>>>> onComponentTagBody. Is this completely wrong, how should testing be
>>>> done? I can see that the dateLabel uses an approach with converters,
>>>> although im not sure how this are done. But are this more propper?
>>>>
>>>>
>>>>         
>>> try something like:
>>>
>>>               WicketTester tester = new WicketTester();
>>>               tester.startPage(Home.class);
>>>               tester.assertContains("foo");
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Testing wicket 1.3

Posted by Frank Bille <fr...@apache.org>.
One thing you also could consider is using the TagTester. Currently you can
find a tag by using the getTagById and getTagByWicketId. My orignial plan
was to have several helper methods for finding the html tags you want for
testing.

http://wicketstuff.org/wicket13doc/org/apache/wicket/util/tester/TagTester.html

Frank


On 9/19/07, Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>
wrote:
>
> Hi Kent
>
> hmm, while this could be okay. I just fear the possibility that tests
> may succeed if other components contains foo. This test does not take
> hierarchy into account..
>
> For the simple Bbcodecomponent, it will work as I will be testing it
> isolated. However if others that are using the component wants to test
> that the out come are correct, this could be a potential pitfall.
>
>
> regards Nino
>
> Kent Tong wrote:
> >
> > Nino.Martinez wrote:
> >
> >> I was wondering how I should be testing with wicket. I've created the
> >> bbcodecomponent, I have a bbcodeLabel. And I would like to write a test
> >> for that. I can see that I can't use the assertLabel as that just gets
> >> modelObjectToString, in the bbcodeLabel some formatting are done during
> >> onComponentTagBody. Is this completely wrong, how should testing be
> >> done? I can see that the dateLabel uses an approach with converters,
> >> although im not sure how this are done. But are this more propper?
> >>
> >>
> >
> > try something like:
> >
> >               WicketTester tester = new WicketTester();
> >               tester.startPage(Home.class);
> >               tester.assertContains("foo");
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Testing wicket 1.3

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Hi Kent

hmm, while this could be okay. I just fear the possibility that tests 
may succeed if other components contains foo. This test does not take 
hierarchy into account.. 

For the simple Bbcodecomponent, it will work as I will be testing it 
isolated. However if others that are using the component wants to test 
that the out come are correct, this could be a potential pitfall.


regards Nino

Kent Tong wrote:
>
> Nino.Martinez wrote:
>   
>> I was wondering how I should be testing with wicket. I've created the 
>> bbcodecomponent, I have a bbcodeLabel. And I would like to write a test 
>> for that. I can see that I can't use the assertLabel as that just gets 
>> modelObjectToString, in the bbcodeLabel some formatting are done during 
>> onComponentTagBody. Is this completely wrong, how should testing be 
>> done? I can see that the dateLabel uses an approach with converters, 
>> although im not sure how this are done. But are this more propper?
>>
>>     
>
> try something like:
>
> 		WicketTester tester = new WicketTester();
> 		tester.startPage(Home.class);
> 		tester.assertContains("foo");
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Testing wicket 1.3

Posted by Kent Tong <ke...@cpttm.org.mo>.


Nino.Martinez wrote:
> 
> I was wondering how I should be testing with wicket. I've created the 
> bbcodecomponent, I have a bbcodeLabel. And I would like to write a test 
> for that. I can see that I can't use the assertLabel as that just gets 
> modelObjectToString, in the bbcodeLabel some formatting are done during 
> onComponentTagBody. Is this completely wrong, how should testing be 
> done? I can see that the dateLabel uses an approach with converters, 
> although im not sure how this are done. But are this more propper?
> 

try something like:

		WicketTester tester = new WicketTester();
		tester.startPage(Home.class);
		tester.assertContains("foo");

-- 
View this message in context: http://www.nabble.com/Re%3A-Testing-wicket-1.3-tf4469190.html#a12758401
Sent from the Wicket - User mailing list archive at Nabble.com.