Forum Discussion

theodoros_kosif's avatar
theodoros_kosif
New Contributor
10 years ago

Reading variables for Testcomplete project from excel or csv files

Hi,

I am running a project which need to initialize all the variables from different tests. Is that possible with an excel file or csv file? 

I am reading in the help files or the resources which smartbear providing by its site but the information it's a little chaotic.



The scope is to run the init file with the wanted values of the variables and the Project test run with the new values. All the variables are project variables.



Thanks in advance

4 Replies

  • murugans1011's avatar
    murugans1011
    Regular Contributor
    HI wat u mean by " initialize all the variables from different tests" does the test are from same project or different projects?? if u want to run testitem from differenct project then u can add to current project using  Scripts|Add Existing Item
  • MikeSchmid's avatar
    MikeSchmid
    Occasional Contributor
    You can use the DDT excel driver to open a spreadsheet and read through the row and set your variables to the contents of what is in the spreadsheet for your initial variables.



    Look up DDTDriver Object in the help and it explains how to use it.
  • sumit_engineer's avatar
    sumit_engineer
    Occasional Contributor


    FilePath = "C:\Envi.ini"

     



    Section = "Environment"



     



     



    Function Read_INI(Section,FilePath)



     



     



    Set FSO = CreateObject("Scripting.FileSystemObject")



    If FSO.FileExists(FilePath) Then



    Set ini = Storages.INI(FilePath)



    ProjectPhase = ini.GetSubSection(Section).GetOption("ProjectPhase","")



     



    Else



    Read_INI = False



    End If



    End EnviFunction



    NOTE : 1.Make Sure in your Enviormnet.ini File [ROOT] is added on the first line .

    2.No Space betweeen ProjectPhase and  = 1 .

    '==================C:\Envi.ini================



    [Root]





    [Environment]



    ProjectPhase=1



    '==================Envi.ini================