Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top