Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[swtbot-dev] Re: Test Recorder

Added swtbot-dev in the discussion. My comments below.

On 2/27/2010 8:47 PM, Ketan Padegaonkar wrote:

On 2/28/10 12:16 AM, Vasanth Velusamy wrote:
Hi Ketan,

I've gotten the Recorder to work with Combo boxes. The generated code
looks like this:

bot.comboBox("value_before_selection").setSelection("value_after_selection");

I had to remember a Combo's state when a Combo receives focus, and then
use it when there is a selection on the Combo. This is because we can't
access a Combo's old value after a selection event is fired.

This is, by no means, complete. I need to handle scenarios such as -
what if the combo did not have a value before? what if the combo needs
to be identified some other way, other than by the old value, etc.

I personally like sahi's recorder for web based applications[1]. It has a very simple, elegant and really smart fall-back mechanism to deal with identifiers. It uses the 'id' on the HTML element, followed by the 'name', 'style' and finally just the index of the element to identify it.

I'm considering something similar, however since swt controls don't have any such identifiers attached to them, things are a lot trickier. We'll probably need some form of a strategy to generate alternative accessors for the same widget and let the user choose what's best.

-- Ketan

[1] http://sahi.co.in/static/website/images/ss/controller_record1.png

In my experience using SWTBot, I've seen that a direct qualifier (such as a label name or a combo's value) is good enough for many cases. But there are many other cases where such a unique identifier is not readily available (as you mentioned earlier, trees, lists, etc. fall in this category). I don't really like using an index to identify a widget. Seems too fragile to me. But thats just my personal opinion.

Anyway, as a solution for the recorder, I was thinking more along the lines of letting the user choose what strategy to use. We can have something like a 'Detailed' mode for the recorder, whereby, whenever a selection has to be made, a dialog will pop up with multiple options for the user to choose from. The options might include selection by index, selection by label, selection by group, etc. - whatever is applicable in that scenario.

- Vasanth


Back to the top