Forum Discussion

DanielM75's avatar
DanielM75
Occasional Contributor
5 years ago

Desktop Application Lag and BDD

Hello Everyone, two questions for you.

 

1. We are executing some testing in Australia connecting to a PC in the US.  Running a desktop app remotely.

The scripts are unreliable - sometimes they work, and then sometimes they can't find an object.

So it seems to be due to lag and slowness of the PC.

 

I saw in another solution that you can wait for each object to become available, would that be the best suggestion here?

i.e.

def wait_for_something_exists(something, timeout):
  counter = 0
  while not something.Exists and c < timeout:
    aqUtils.Delay(1000) # or time.sleep(1)
    counter += 1

 

2.  I am very new to BDD.  I have some code written and it works, but the goes through my entire code twice.  I only want it to iterate for each example certain parts of the code.

i.e. my code is this:

 

Feature: Generate Check

 @StartApp
 @EndAp

Scenario Outline: Generate checks
When I load the Checks forms
When I load the <Customer>
Then I generate check(s) for <Customer>

Examples:
|Customer|
|1000000025 |
|1000000025 |

I am using hooks to start and end the application.

 

What I want it to do is only execute these lines for each example:

When I load the <Customer>
Then I generate check(s) for <Customer>

 

But it executes everything, including the hooks.

  • I'm not very good at BDD either... but the wait code.... it's alot simpler than that.

     

    So, let's say you have an object... Aliases.MyApp.MyForm.MyButton... and you want to wait for the button.  Do this.

     

    (code is pseudo JavaScript)

     

    if (Aliases.MyApp.MyForm.WaitAliasChild('MyButton', 20000).Exists) {
        Log.Message('The object existss')
        Aliases.MyApp.MyForm.MyButton.Click()
    }
    else Log.Message('The object does not exist')

    There are a variety of "wait" functions and methods built in to TestComplete which will wait for an object to exist.  If it does exist, the function actually returns the object itself.  If it does not exist, the function will return a "stub" object with one property (Exists) set to False.

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I'm not very good at BDD either... but the wait code.... it's alot simpler than that.

     

    So, let's say you have an object... Aliases.MyApp.MyForm.MyButton... and you want to wait for the button.  Do this.

     

    (code is pseudo JavaScript)

     

    if (Aliases.MyApp.MyForm.WaitAliasChild('MyButton', 20000).Exists) {
        Log.Message('The object existss')
        Aliases.MyApp.MyForm.MyButton.Click()
    }
    else Log.Message('The object does not exist')

    There are a variety of "wait" functions and methods built in to TestComplete which will wait for an object to exist.  If it does exist, the function actually returns the object itself.  If it does not exist, the function will return a "stub" object with one property (Exists) set to False.

    • DanielM75's avatar
      DanielM75
      Occasional Contributor

      Great thanks I will check this out

      • sonya_m's avatar
        sonya_m
        SmartBear Alumni (Retired)

        Thank you tristaanogre!

         

        DanielM75 did you give this a try? Please share your results.