Page 1 of 1

Am i doing it right?

Posted: Wed Oct 05, 2011 4:35 pm
by fredric berling
var toolbar = app.down('toolbar');
if(!toolbar){
   t.fail('Could not find toolbar')
   t.done();
   return;
}
Is this the correct way of aborting if a component isn't there?

Re: Am i doing it right?

Posted: Wed Oct 05, 2011 7:26 pm
by nickolay
Yes, everything is correct.

Re: Am i doing it right?

Posted: Thu Oct 06, 2011 1:47 pm
by mats
Or more shorthand:
var toolbar = app.down('toolbar');
t.ok(toolbark, 'Toolbar found');

Re: Am i doing it right?

Posted: Thu Oct 06, 2011 3:13 pm
by fredric berling
But i would not get a meaningful message in the log if it failed right? .. Just a script line

Re: Am i doing it right?

Posted: Thu Oct 06, 2011 3:15 pm
by mats
It would say that it failed in the assertion list and the message would be "'Toolbar found'". What would ye like?

Re: Am i doing it right?

Posted: Thu Oct 06, 2011 3:20 pm
by fredric berling
Oh...ok.. Thats good. Must have missed that feature :)