On 11-Jul-08, at 11:41 PM, Somesh Sasalatti wrote:

> test(){
> data1 = mymethodtogetdata();
> data2 = mymethodtogetdata();
>
> return data1.equals(data2);
> }
> });
>
> mymethodtogetdata() is defined to throw myException.
>  mymethodtogetdata() throws myException{
> ...}
>
> you can argue that data1 and data2 should be retrieved before the  
> test condition outside of bot.waitUntil() which is fine.
> but the whole concept of waituntil is that it checks for the  
> condition, sleeps for an interval and checks again till timeout. so  
> to speak mymethod can return a different data in the meanwhile which  
> is why it is inside the test.
>
> now, if mymethod throws the myException, m screwed cos the waitUntil  
> method will only return a timoutException.
>
> thoughts?

I'm not sure if I get you right. Based on my interpretation are you  
asking for some preTest/postTest methods ? If you need to do something  
like this a lot of times, you could just write your own ICondition  
that uses the template pattern:

public abstract class MyCondition extends DefaultCondition{
   // the template methods
   protected abstract void preTest();
   protected abstract void doTest();
   protected abstract void postTest();

   // wire them up
   public void test() throws Exception{
     try{ preTest(); }catch (Exception e){}
     try{ doTest(); }catch (Exception e){}
     try{ postTest(); }catch (Exception e){}
   }

}

Could you reword your problem, or give another example to clarify, in  
case I'm mis-interpreting ?

-- Ketan



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
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