Forum Discussion

Tallmage's avatar
Tallmage
New Contributor
6 years ago

Checking if Application Already Started, Without Throwing Warning

Hello,

 

I'm looking at optimizing our tests.  Currently, our tests start the Application Under Test, do the test, and then stop the test.  This ensures a clean working environment and sanitized conditions for verifications.

 

It also takes a long time.

 

  • We try to keep our tests at a 1 to 1 mapping (1 Test for 1 Verification).  But that becomes a problem if we're running, say, 900 verifications.  In our suite, that would be 900 restarts.
  • We also don't want to write all the verifications in one gigantic test script, this becomes less than ideal to maintain.
  • We could suppress the error that says the application is already started, but the product owner doesn't want us to do suppress the warning.
  • We could disable the log when looking if the application is already started, but, the product owner doesn't want us to disable the log.

Is there a way to start up the Application Under Test, run X tests against it, and then stop it, in one run, without 1 gigantic wrapper test, without supressing the warning, or without disabling the logs?

 

Additional information:

  • We write our tests in Python, using NameMapping and TestedApps.
  • Our AUT is windows based in .NET.

Thank you for your time.

3 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    .WaitXXX() methods complimentary to those without Wait prefix are provided by TestComplete exactly for this. (See documentation for more info.)

    For example:

    var p = Sys.WaitProcess('YourTestedProcess', 500);

    if (!p.Exists)

      p = TestedAllpications.<YourTestedApp>.Run();

    // use p here

     

  • shankar_r's avatar
    shankar_r
    Community Hero

    Tallmage wrote:

     

    Is there a way to start up the Application Under Test, run X tests against it, and then stop it, in one run, without 1 gigantic wrapper test, without supressing the warning, or without disabling the logs?


    This has to be handled via scripting, If you are using Project Test Item to run individual tests then I would suggest creating a common function which restarts the AUT then insert that function as a Project Item between every X number of Project Items

     

    If you are using the framework then it would be easy to create a variable and do some math with a variable when you want to restart.

  • cunderw's avatar
    cunderw
    Community Hero

    My suggested approach would be to have a known starting / ending point in your application that each must start at and the end at. You can then use event handlers to check that the application is in the expected state, if it's not THEN restart it.