On 09-Oct-08, at 7:40 AM, mpauser wrote:

>
> I have a Eclipse application dialog which has two radio buttons --  
> one radio
> label is static, the other starts with a static string but then  
> additional
> text is appended. At runtime, I don't know what the additional text  
> will be.
> For example:
>
> o Choice 1
> o Choice 2 (timestamp blahblah)

You can also use the RegexTextMatcher matcher as this, this will also  
make your tests more robust (just in case someone adds another button,  
or the order of the button changes):

List findControls = finder.findControls(shell.widget, new  
DecoratingAndMatcher(ClassMatcher(Button.class), new  
RegexTextMatcher("^Choice 2.*")), true);
if (findControls.isEmpty())
   throw new WidgetNotFoundException("Could not find any table");
return new SWTBotRadio((Button) findControls.get(0));


Note the order in which the matchers are used also help performance.  
Matching the types first filters out much quicker than matching every  
control with a regex!

-- Ketan


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
SWTBot-users mailing list
SWTBot-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse

Reply via email to