Forum Discussion

JacobEJ's avatar
15 years ago

Test Complete does not remember variable definition

I am haing two problems with Test Complete 7.2



1. I have a function which has a variable defined for a form. I am using the variable at different places within the function. The first time I use the variable it works fine. But when the variable is used the second time I get an error mesg 'Object required'.



Here's the code



Set p1 = Sys.Process("CerberusNet")

Set w1 = p1.MainForm



Call w1.StripMainMenu.Click("Managers|Tool String Editor...")   ------> Works over here

Delay 3000

Set w2 = p1.VBObject("frmSelect")

Call w2.VBObject("cmdCancel").Click


 


Call w1.StripMainMenu.Click("Managers|Tool String Editor...")   ------> But at this line it gives me the exception 'Object Required' for w1.



I have had this script for a while and just started having problems yesterday.



2. For the script above, when Test Complete opens the "frmSelect",  it would randomly not recognize the window. And when I checked the Object browser it had the name 'Window("ThunderRT6FormDC", "Select Tool String", 1)'.

I don't have 'Use Native Object' selected on my Project Properties.



Thank you.


3 Replies


  • Hi Elizabeth,





    We have the same request from you in our database. Let's continue working via e-mail.
  • aldebaran's avatar
    aldebaran
    Occasional Contributor
    Hi Alex,



    I believe I have a similar problem! Depending on the result in a script test I set global variables. I want to do this so I don´t have to worry about if the test-suite is executed on a developers machine or the auto-testing machine with testexecute.

    Here`s a code snippet:



    Set objNetwork = CreateObject("WScript.Network")

      strComputerName = objNetwork.Computername

      strCheckVal = "UT-"  

      Erg = Instr(1, strComputerName, strCheckVal)

      If Erg <> 0 Then

      ' if not equal to 0 we must be on  build-server

        Project.Variables.AppDir = SomeDir

       

        Project.Variables.DatabaseName = "Bauhaus"

        Project.Variables.DBCleanerDir = "C:\mut\TcDbCleaner"

        Project.Variables.Entwicklungsrechner = False

      Else

      ' if 0, must be developer´s machine 

        Project.Variables.AppDir = someOtherDir

        Project.Variables.DatabaseName = "TCDB"                  SartoriusMembranTC

        Project.Variables.DBCleanerDir = "..\..\..\..\TestCompleteDBCleaner\bin\Debug"

        Project.Variables.Entwicklungsrechner = True

      End If 



    It all works nicely and above Script is executed only once. The global variable "Project.Variables.DatabaseName" however is used before each individual keywordtest. It is passed a commandline-argument to a tool the cleans and inserts testdata. At some stage during the testrun that variable is set back to it´s default value and I cannot figure out when or why?



    any suggestions are appeciated



    greetings



    Carsten

  • Hi Carsten,





    What exact TestComplete version are you using ('Help | About...')? Could you please zip your entire project suite folder along with the log of the failed test execution and send me the archive so I can see exactly where you use the project variable in your project?