UiBinder - Auto Generating Selenium Test Stubs

49 views
Skip to first unread message

Sripathi Krishnan

unread,
Sep 19, 2009, 7:50:36 PM9/19/09
to google-web-tool...@googlegroups.com
Hi,

UiBinder does an awesome job of creating type safe code, but it doesn't do a whole lot for functional testing using a client like selenium. Specifying the debugId parameter in the *.ui.xml helps, but UiBinder can do a lot more.

For eg, UiBinder knows that the id has been provided for a button. So, it could easily generate a Selenium specific java class with the methods 'clickXXXButton()' where xxx is the ID. For things like text boxes, it could have auto-generated enterXXX() methods.

The advantage of this is that the compiler would throw errors if someone inadvertently changes the id of a field - the test code Also, the test case becomes more readable and maintainable.

I am about to implement something on the above lines, but wanted to know if has anybody has done anything similar before. Would save me some effort..

Also, I read a few days ago that the GWT team were working on a HtmlUnit based testing methodology, and I was not sure if the above approach would become useless once that got released.

Thoughts/Comments?

--sri

John Tamplin

unread,
Sep 20, 2009, 8:50:41 PM9/20/09
to google-web-tool...@googlegroups.com
On Sat, Sep 19, 2009 at 7:50 PM, Sripathi Krishnan <sripathi...@gmail.com> wrote:
Also, I read a few days ago that the GWT team were working on a HtmlUnit based testing methodology, and I was not sure if the above approach would become useless once that got released.

HtmlUnit will primarily replace the use of the existing embedded browser -- to test things that require a real browser (such as layout, or places where HtmlUnit provides inaccurate emulation), you would need to use Selenium (and you could use it either in web mode, which requires a JS compile, or in development mode, which would require arranging for the Selenium browser to have a plugin (and for FireFox, in the appropriate profile).

So work spent on improving Selenium integration will not be wasted on account of HtmlUnit work (not sure about WebDriver).

--
John A. Tamplin
Software Engineer (GWT), Google

Ray Ryan

unread,
Sep 21, 2009, 11:35:59 AM9/21/09
to google-web-tool...@googlegroups.com, Rodrigo Damazio
It's a neat idea. How would you avoid specific dependencies between UiBinder and Selenium? If you're looking to introduce hooks into the UiBinder parsing and code generation process, I don't think we're ready for that yet. The current api at that level is a mess and we need to be able to tidy it up, something that is unlikely to happen in the 2.0 time frame.

Sripathi Krishnan

unread,
Sep 21, 2009, 12:00:32 PM9/21/09
to google-web-tool...@googlegroups.com, Rodrigo Damazio
How would you avoid specific dependencies between UiBinder and Selenium?
I wanted to hook it with the code generation process; but given that UiBinder is itself evolving, I think I will parse the XMLs outside of the gwtc compiler. If it shapes up nicely, I will start a thread later to see if we can hook it into gwtc.

re. Web Driver v/s Selenium
If we introduce a hierarchy of test classes similar to the Widget hierarchy, we can be truly agnostic of what framework we use. We could just write a test like

loginId.enter("sripathi...@gmail.com");
password.enter("secret");
loginButton.click();

because while parsing the ui.xml, we know that debugId = "loginId" is a TextBox, while "loginButton" is a Button.

Thanks for your thoughts!

--Sri


2009/9/21 Ray Ryan <rj...@google.com>
Reply all
Reply to author
Forward
0 new messages