Forum Discussion

salley's avatar
salley
Frequent Contributor
8 years ago

Data Driven Frameword

Hi Experts,

i'm trying to create a data driven framework and i've five screens, and all 5 screens reads data from the same sheet. so if i create a driver script and call all 5 screens from driver script then how do i pass data into those 5 screens ,should i create excel objects in on start events? is there a better way? Thanks

  • It doesn't really matter how many screens need the data.  You start the DDT driver before you need it and close it afterwards.  I prefer to start mine in line right before I use it so it's clear which one I am using at which time.  If you only have one sheet, this may not be an issue, but I have some places where I have nested DDTs and it's easy to get them confused.

    • salley's avatar
      salley
      Frequent Contributor

      Thanks for looking into it, I'm trying to do something like that can you please look at it Thanks !

       

      Sub PracticeDriverScript
      Dim sAtiveLogin
      sAtiveLogin=Trim(ObjWorkSheet.Cells(2,3))
      If sAtiveLogin <>"Y" Then
      log.Error "Please Set Y to desired Active User"
      Runner.Stop
      Else
      Call Sc_1
      Call Sc_2
      Call Sc_3
      End If
      End Sub

      '+++++++++++++++++++++++++++++++++++++++++
      Sub Sc_1
      product = Trim(ObjWorkSheet.Cells(td_row,2))
      quantity = Trim(ObjWorkSheet.Cells(td_row,3))

      End Sub
      '++++++++++++++++++++
      Sub Sc_2
      date1 = Trim(ObjWorkSheet.Cells(td_row,4))
      customer_name = Trim(ObjWorkSheet.Cells(td_row,5))


      End Sub
      '++++++++++++++++++++
      Sub Sc_3
      street = Trim(ObjWorkSheet.Cells(td_row,6))
      city = Trim(ObjWorkSheet.Cells(td_row,7))

      End Sub
      '++++++++++++++++++++++

      Sub EventControl1_OnStartTest(Sender)
      Set ObjExcelApp=Sys.OleObject("Excel.Application")
      Set ObjWoorkBook=ObjExcelApp.Workbooks.Open("C:\Users\A6S\Desktop\Sampleworkbook.xlsx")
      Set ObjWorkSheet=ObjWoorkBook.Sheets("Agent_Id_Pwd")
      End Sub

      • Marsha_R's avatar
        Marsha_R
        Moderator

        Are you having problems with this code?  I see a typo here:

         

        Set ObjWorkSheet=ObjWoorkBook.Sheets("Agent_Id_Pwd")

         

        ObjWoorkBook should be ObjWorkBook