0

I'm trying to do some data driven testing with Marathon and I'm entering in some data on a screen. The problem that I'm having is that one of the JComboBoxes that I'm trying to fill in is not always enabled(i.e. sometimes it goes to a default value). I need to be able to skip the step if the JComboBox is not enabled.

if object enabled:
    select('object', 50) #otherwise skip and move on

I've tried to use the assertEnabled call, but I can't figure out exactly what that returns. I've embedded the assertEnabled in an if-statement and I didn't get any syntax errors, but whenever I execute the test it gets hung up on the if-statement and does nothing. I wish it would throw an error so that I could just use a try catch, but it doesn't. Any suggestions on how I can get it to pass over the step if a certain object is not enabled? Also, I'd rather not use a timer and have it look for a certain period of time because we run thousands of test cases in our regression and this would make the script take days if not weeks to complete.

Ross Allen
  • 43,772
  • 14
  • 97
  • 95
Nick L
  • 281
  • 1
  • 6
  • 18

2 Answers2

1

Marathon has a get_component function that gives you the actual Java component (see the "script interface" section in the documentation). This function will pause for a time and then fail if the object can't be found.

But assuming that the object exists, you could find it with get_component and then obtain its status by invoking java.awt.Component's isEnabled on it.

danidiaz
  • 26,936
  • 4
  • 45
  • 95
  • I'm unable to find this "script interface" in the documentation. To what documentation are you referring? I've search the marathon user guide through and through. – Nick L Jan 24 '14 at 21:09
  • @Nick L http://marathontesting.com/wp-content/downloads/marathonite-userguide.pdf page 121. – danidiaz Jan 24 '14 at 21:25
0

There is a method called get_p which returns a property value from a Java object. You can check with get_p('object', 'enabled') which returns 'true' or 'false'. Note the return values are strings not boolean objects.

Dakshinamurthy Karra
  • 5,353
  • 1
  • 17
  • 28