Forum Discussion

JackSparrow's avatar
JackSparrow
Frequent Contributor
8 years ago

Usage of Project Suite Variables . Does it recommended ?

Hi All,

 

Normally we will store the data which we need to test our applications in different data formats(Excel,Notepads ..etc) and use them by creating an object connection between test complete and the different data sources(Excel,Notepads ..etc).

 

In test complete we have a feature Project And Project Suite Variables where we can create a variable and store data & use it while executing or declare the variable in the Project Suit variable Tab  and call the ProjectSuite.variables.myvariables.

 

So my doubt is can we relay on using the test complete feature project suite variables for storing the data and use it in the scripts instead of using the Excel and other data storing formats.

 

I know that there are lot of advantages using the test complete project suite variables since am using it daily but still does it recommended to use  instead of excel or notepads for storing the data and use it every time.

 

 

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I'll give you the standard answer:

     

    it depends. :)

     

    If you are storing single bits of data (a string, an integer, etc) for reuse in other tests within the same project, I don't see any reason why you could not use the Project and Project Suite variables.  For that matter, if you create a variable of the type "db Table", you can link your Excel sheets, text files, etc, to that variable for being able to read that information into your tests.  The caveat to that is that the db Table variable type allows only read-only access to the linked files.  You can't then write out to the Excel or Text files.

     

    If you need both read/write access to your files, then yes, you shouldn't be using the project and project suite variables.  But if you are doing read only access, then there shouldn't be a problem.

     

    Generally speaking, there is no direct advantage or disadvantage on using test complete's variables.  It all comes down to your specific needs and usage as to whether they will provide what you need in the most efficient manner.

  • NisHera's avatar
    NisHera
    Valued Contributor

    I also agree with tristaanogre 

    Usually I keep generally common stuff eg (database name, application paths, user details) in project variables.

    In my situation , I try to keep minimum number of data in project variables, otherwise whole set up gets clumsy. 

    it's relatively easy to manage data in excel.

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I like to use project and project suite variables to keep (runtime) test configuration data and to exchange dynamic data between tests (e.g. id of created account, list of ordered items, etc.)

    The real advantage of project variables in the projects opened in the shared mode was that variables' values were personalized and the same variable could be used concurrently by the same test running at the same time on two different machines. Unfortunately, this great feature seems to be broken in the past versions of TestComplete and I am not sure if it is going to be fixed.

    Another problem with project variables is that their values are stored in the project file not in clear text and TestExecute does not provide any means to change the value of some variable before test run. This makes it not convenient to store test configuration data just in project variables because it is not easy to set their values on the systems that have only TestExecute installed. Situation here is more clear: it was said that it is not planned to add any UI features to TestExecute to make it possible to set project variables.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      AlexKaras wrote:

       

      The real advantage of project variables in the projects opened in the shared mode was that variables' values were personalized and the same variable could be used concurrently by the same test running at the same time on two different machines. Unfortunately, this great feature seems to be broken in the past versions of TestComplete and I am not sure if it is going to be fixed.

       


      Actually, doesn't that still "live" with persistent variables?  It's not present for temporary variables, but persistent it is.  You need to explicitly create the variable as persistent to get that localized value.

       

      As for the inability to set variable values on TestExecute machines... yeah, not convenient, but we solved that in the past by creating an INI file that resided on each workstation that, on project startup, we would read the values in from there into the appropriate persistent variables.  Worked pretty well for quite a number of years, actually. :)

       

      These days, I don't use project or project suite level variables so much.  If I need something passed between projects, usually it's something necessary for the overall framework in which I'm functioning.. and since the framework is all in ScriptExtensions, I just make my "global" variables properties on my RuntimeObjects. 

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi Robert,

         

        > Actually, doesn't that still "live" with persistent variables?

        Not sure and probably need to double-check. According to what I remember, I found this problem exactly for persistent variables (after I did not use shared mode for a year or more).

         

        Finally, I also ended-up with some sort of INI file (actually, .csv assessed via SQL ;) ) that is used to populate project variables with data. The only difference is that for this I prefer temporary variables more because a) I do not need their values to be preserved between test runs (when this is needed, the same INI file is used); and b) When the value of persistent variable is changed, the project is marked as modified and, when using version control system, you need either explicitly discard changes or accept them. Also, when in shared mode, other users receive message that the project was changed and needs to be reloaded. This does not happen for temporary variables.