Forum Discussion

IRISQATeam's avatar
IRISQATeam
Contributor
11 years ago

Getting an run time exception when data type changes in Microsoft Excel

Hi,

I am building data driven tests cases, I am facing problem when values changes in the column.

 

This is line entering client id in the system

Aliases.PersonalTaxObjectMap.wndClientBrowser.txtClientId.Keys.DDT.CurrentDriver.Value("ClientId")

 

In the excel sheet there is column called

ClientId

A045
40930

 

Testcomplete enters the first client (A045) successfully but throws Microsoft VB Script runtime error with Type mismatch for second client (40390)

 

The format of this column in MS Excel is General , I also tried other text option. Also tried to give different format general/text to A045 and number to 40930.

 

If I run the clients other way round

ClientId

40930

A045

It runs first client (40930) then throws exception for the next one.

 

Any ideas or solution for this?

 

 

 

 

 

5 Replies

    • IRISQATeam's avatar
      IRISQATeam
      Contributor

      Hi Ryan,

      Thanks for your reply. Here is the code.

       

      '
        'Saving Personal Tax Forms & Reports
        '
        Sub SavePersonalTaxExternalIssuesReports
       
          Set Driver = DDT.ExcelDriver("C:\IRISAutomation\IRISExternalIssues\IRISExternalIssues.xls" ,"SavePeronalTaxIssuesReports")
          
           'Appending the log    
          Log.AppendFolder("Saving Reports For Personal Tax External Issues Clients")  
           
          'Start of Do Loop
          Do
          
          'Call selectClientAndTaxYear
          Call ExtraSmallDelay
          Call SelectClientAndTaxYear

          'If report type is Tax Computations
           If(Driver.Value("ReportType")="TaxComputation") Then  
              Call ExtraSmallDelay
              Call TaxComputation    
           End If    
          
          'Loop until EOF
          Call Driver.Next
          Loop Until Driver.EOF
          
          'Pop log folder in test log
          Log.PopLogFolder()
       
        End Sub

        '
        'Selecting the client & tax year
        '  
        Sub SelectClientAndTaxYear
       
          'Appending the log    
          Log.AppendFolder("Select Client & Tax Year " + DDT.CurrentDriver.Value("Description"))
          
          'Select Client|Select
          Aliases.PersonalTaxObjectMap.wndIWINPTAX.MainMenu.Click("Client|Select")
          
          'Select Search By Combobox
          Aliases.PersonalTaxObjectMap.wndClientBrowser.cmbSearchBy.ClickItem("by Client ID")
          
          'Enter Client Identifier and select client    
          Aliases.PersonalTaxObjectMap.wndClientBrowser.txtClientId.Click
          Aliases.PersonalTaxObjectMap.wndClientBrowser.txtClientId.Keys("^a")
          Aliases.PersonalTaxObjectMap.wndClientBrowser.txtClientId.Keys("[BS]")
                    
          Set  Aliases.PersonalTaxObjectMap.wndClientBrowser.txtClientId.Keys(DDT.CurrentDriver.Value("ClientId"))
              
          'Click Select button
          Call VerySmallDelay
          Aliases.PersonalTaxObjectMap.wndClientBrowser.btnSelect.Click
          
          'Click Leave button in No Client Tax Data Entered
          If(Aliases.PersonalTaxObjectMap.wndNoClientTaxDataEntered.Exists)Then
              Aliases.PersonalTaxObjectMap.wndNoClientTaxDataEntered.btnLeave.Click
          End If
               
          'Select the tax year  
          Set enterTaxYear = Aliases.PersonalTaxObjectMap.wndIWINPTAX.ToolbarWindow32.cmbTaxYear
          enterTaxYear.ClickItem(DDT.CurrentDriver.Value("TaxYear"))
              
          'Pop log folder in test log
          Log.PopLogFolder()         
       
        End Sub

       

      Exception.png

       

      It is getting exception on the second client.

      I also performed debugging, for first time it brings correct values, for second it bring null value.

       

      Regards,

      Zeeshan

      • Ryan_Moran's avatar
        Ryan_Moran
        Valued Contributor

        Hmm..

        Can you try this and see if it still errors?

         

        '
          'Saving Personal Tax Forms & Reports
          '
          Sub SavePersonalTaxExternalIssuesReports
         
            Set Driver = DDT.ExcelDriver("C:\IRISAutomation\IRISExternalIssues\IRISExternalIssues.xls" ,"SavePeronalTaxIssuesReports")
            
             'Appending the log    
            Log.AppendFolder("Saving Reports For Personal Tax External Issues Clients")  
             
            'Start of Do Loop
            Do
            
            'Call selectClientAndTaxYear
            Call ExtraSmallDelay
            Call SelectClientAndTaxYear
        
            'If report type is Tax Computations
             If(Driver.Value("ReportType")="TaxComputation") Then  
                Call ExtraSmallDelay
                Call TaxComputation    
             End If    
            
            'Loop until EOF
            Call Driver.Next
            Loop Until Driver.EOF
            
            'Pop log folder in test log
            Log.PopLogFolder()
         
          End Sub
        
          '
          'Selecting the client & tax year
          '  
          Sub SelectClientAndTaxYear
         
            'Appending the log    
            Log.AppendFolder("Select Client & Tax Year " + DDT.CurrentDriver.Value("Description"))
            
            'Select Client|Select
            Aliases.PersonalTaxObjectMap.wndIWINPTAX.MainMenu.Click("Client|Select")
            
            'Select Search By Combobox
            Aliases.PersonalTaxObjectMap.wndClientBrowser.cmbSearchBy.ClickItem("by Client ID")
            
            'Enter Client Identifier and select client    
            Aliases.PersonalTaxObjectMap.wndClientBrowser.txtClientId.Click
            Aliases.PersonalTaxObjectMap.wndClientBrowser.txtClientId.Keys("^a")
            Aliases.PersonalTaxObjectMap.wndClientBrowser.txtClientId.Keys("[BS]")
                      
            Aliases.PersonalTaxObjectMap.wndClientBrowser.txtClientId.Keys(DDT.CurrentDriver.Value("ClientId"))
                
            'Click Select button
            Call VerySmallDelay
            Aliases.PersonalTaxObjectMap.wndClientBrowser.btnSelect.Click
            
            'Click Leave button in No Client Tax Data Entered
            If(Aliases.PersonalTaxObjectMap.wndNoClientTaxDataEntered.Exists)Then
                Aliases.PersonalTaxObjectMap.wndNoClientTaxDataEntered.btnLeave.Click
            End If
                 
            'Select the tax year  
            Set enterTaxYear = Aliases.PersonalTaxObjectMap.wndIWINPTAX.ToolbarWindow32.cmbTaxYear
            enterTaxYear.ClickItem(DDT.CurrentDriver.Value("TaxYear"))
                
            'Pop log folder in test log
            Log.PopLogFolder()         
         
          End Sub