-
1. Re: Is JSFClientSession.setChecked broken?
ssilvert Jun 18, 2008 9:59 PM (in response to kragoth)No you haven't lost your mind, but I have. This method was never tested. Our unit test for checkbox doesn't call this method. It just uses plain old click():
public void testSetCheckbox() throws IOException { client.click("funcheck"); // uncheck it client.click("submit_button"); assertFalse((Boolean)server.getManagedBeanValue("#{checkbox.funCheck}")); client.click("funcheck"); // make it checked again client.click("submit_button"); assertTrue((Boolean)server.getManagedBeanValue("#{checkbox.funCheck}")); }
I think the setChecked() method should just be removed from JSFClientSession. What do you think?
Stan -
2. Re: Is JSFClientSession.setChecked broken?
kragoth Jun 18, 2008 10:14 PM (in response to kragoth)Well, that depends on how hard it is to get the current status of the checkbox.
If I want to do a test where the checkbox is set to true... I don't want to rely on my own knowledge that it was false before.
I just want to know that I am setting it to true.
This would seem easier to do by the setChecked method in my opinion. But I can see how that the click method is more 'life like'.
I havn't really taken the time to check how to get the value of the checkbox so....I'm not sure how much work is involved in that yet. -
3. Re: Is JSFClientSession.setChecked broken?
ssilvert Jun 18, 2008 10:33 PM (in response to kragoth)"Kragoth" wrote:
I havn't really taken the time to check how to get the value of the checkbox so....I'm not sure how much work is involved in that yet.
From the client side, you just do this:HtmlCheckBoxInput checkbox = (HtmlCheckBoxInput)jsfClientSession.getElement(componentID); boolean isChecked = checkbox.isChecked();
Or you can get it from the server side using JSFServerSession.getManagedBeanValue() or JSFServerSession.getComponentValue().
Stan -
4. Re: Is JSFClientSession.setChecked broken?
ssilvert Jun 18, 2008 10:40 PM (in response to kragoth)"Kragoth" wrote:
If I want to do a test where the checkbox is set to true... I don't want to rely on my own knowledge that it was false before.
I just want to know that I am setting it to true.
This would seem easier to do by the setChecked method in my opinion. But I can see how that the click method is more 'life like'.
We've got some thinking to do. This kind of thing came up in another thread earlier today. You can always drop back to the HtmlUnit API for this stuff after you call client.getElement(componentID).
One man's great feature is another man's API bloat. It's tough to decide on a good balance.
Stan -
5. Re: Is JSFClientSession.setChecked broken?
kragoth Jun 18, 2008 10:57 PM (in response to kragoth)I agree, I'm just trying to make it easier for me :P
I can always add the method I want to my api and that way the get Element etc code is abstracted away from the other developers. I'm trying to make using JSFUnit testing as easy as possible for them.
But where the line should be drawn on this is very hard. Probly wouldn't hurt that much to remove it. As it seems that it's not that hard to check the value manually.