Forum Discussion

korayekici's avatar
korayekici
New Contributor
15 years ago

How to make parametric test in functional testing

I want to make automize my functional testing with parametric and I want to read my login and password information on excel. I examine the help pages but i think the help pages is not clear. Can you help me?

2 Replies

  • Try to use these scripts. Actualy there is an easy way to use parameters in TestComplete. Just import your excel data into access (or other database) and use parameter wizard too to get the parameters from Access. Then, after recording your task, select approprite variables within your task's requests.



    Sub Main

    path = "c:\text1.txt"

    set fs=createObject("Scripting.FileSystemObject")

    If not fs.FileExists(path) Then

    Log.Message("Fail: file does not exist")

    Else

    Log.Message("Pass: File exists")

    End If

    End Sub


    Sub Delete

    path = "c:\text.txt" 

    set fs=createObject("Scripting.FileSystemObject")

    If not fs.FileExists(path)  Then

    Log.Message("Fail: file does not exist")

    Else

    fs.deletefile(path)

    Log.Message("Pass: File deleted")

    End If

    End sub

    '//////////////////////////////////////////////////

    Sub ExcellSheetsName 

    Set p = Sys.WaitProcess("EXCEL")

    'this will Make sure you close any Excel work book already open

    If p.Exists Then

    Call p.Terminate()

    End If


    'This is setting the driver

    Set MsExcel = Sys.OleObject("Excel.Application")


    'This will open you workbook

    'Specify the location of your excel file

    Call MsExcel.Workbooks.Open("c:\test.xlsx")

    MsExcel.Visible = True


    'To Loop through all the sheet

    for I = 1 to MsExcel.sheets.Count

    'To activate the sheet

    msexcel.Sheets(I).Activate

    'To get the name of the active sheet

    MsgBox(MsExcel.activesheet.name)

    Next

    End Sub