Forum Discussion

srigudav's avatar
Occasional Contributor
10 years ago

How to drive test case execution based on the priority set in Excel sheet


I am very much new to test complete. I have gone through user guide for reading data from excel sheet etc.

Let say if i have two scenario's which i will either mark as "Yes" or "No" in the sheet. my question here is how can i drive my test execution based on this file. Can some pls quote with an example.

Attatching the sample excel sheet for reference.

Thanks in advance,


7 Replies

  • srigudav's avatar
    Occasional Contributor
    Hi All,

    hank you for the updates.  I was able to do by the below code.

    Sub ReadExcel


    End Sub

    'sFileName= xls file name with path

    'Sheetname = table name

    'VRstatmt = where statment for query

    'Colname=Column name to fetch value from


    Public Function QryXls_GetData( sFileName)

    Const adOpenStatic = 3

    Const adLockOptimistic = 3

    Const adCmdText = "&H0001"

    sql_text="Select * FROM [driver$]where [Scenario Required]='yes'"

     '1) Create an ADODB connection and recordset

    Set objConnection = CreateObject("ADODB.Connection")


    '2) Open connection'

    objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & sFileName & ";" & "Extended Properties=""Excel 8.0;HDR=Yes;"";"

    '3) Create a Recordset'

    Set objRecordSet = CreateObject("ADODB.Recordset")

    '4) Execute SQL and store results in reocrdset'

    objRecordset.Open sql_text , objConnection, adOpenStatic, adLockOptimistic, adCmdText

    '5) Read all fields data   and store in a array'

    'For Multiple records


    ReDim  SQLExpectedData(objRecordset.recordcount -1)

    For i=0  to objRecordset.recordcount -1  'objRecordset.fields.item(1).properties.count

        SQLExpectedData(i)= objRecordset.fields("Test case")

        functionname = "call "& objRecordset.fields("Test case")

          msgbox (functionname)

            execute functionname





    '6) Close and Discard all variables '



    End Function
  • srigudav's avatar
    Occasional Contributor
    Hi Ravi,

    Only intenion for using this is as on today we are looking at Excel, May be infuture if we chage to SQl also i thought this will be having minimal changes. 

    Please correct me if my undersatnding is wrong. I have very minimal knowledge on this.

    Thanks in Advance.
  • NisHera's avatar
    Valued Contributor
    Can you please mention how would u expect to develop tests...

    is it KDT or scripting?

    if scripting which language?
  • srigudav's avatar
    Occasional Contributor

    Sorry for not mentioning the details.

     I would like to know using VB scripting
  • Marsha_R's avatar
    Champion Level 3
    It will be something like this:

        While Not testingsheet.IsEOF

             If (testingsheet.Value("Test Case required") = "Yes") Then

                  ' use scenario to do test

             End If

             Call testingsheet.Next



  • Ravik's avatar
    Super Contributor
    Hi Srikala Gudavalli,

    I don't understand, for reading data from excel why you create - 

      '1) Create an ADODB connection and recordset

      2-  Open connection'

     objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & sFileName & ";" & "Extended Properties=""Excel 8.0;HDR=Yes;"";

    3)-  Create a Recordset'

     '4) Execute SQL and store results in reocrdset'

    have you used Open Office instead of Microsoft Office or using "Office Starter" .

    because normally we want to work with Microsoft Office (Excel) we can create object of Excel like below

    Set Exo = CreateObject("Excel.Application") ot

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

    Exo.Workbooks.Open("Excel File Path")





    Could you please share/Explain it in more.