Forum Discussion

ajb's avatar
ajb
Occasional Contributor
12 years ago

Data driven data with blank optional fields

I'm new to TestComplete. I have set up a NameMapping test and have included a Data-Driven Loop which I populate with data from an Excel spreadsheet. I was able to get this to work fine for my first set of data.



I then added additional lines of data to load into the test. In our application some data fields are optional and therefor the values in the cells for those fields are blank. When I run the test with the data with blank fields I get error messages. I've read a number of the forum discussions about using Excel for data and I am aware of the limitation that all values in a column must be the same type of data.



I was able to switch my data source to a CSV file easily, but I still get an exception "Type mismatch" on the first blank field in the data.



Blank optional fields are valid in my application. How can I use data driven loops to load those records?

4 Replies



  • Use Empty (I used in vb) keyword within  the if condition for all of optional field.  



    Let say if Mobile is optional, following code will do for you



        If (DDT.CurrentDriver.Value("Mobile")<> Empty) Then 



        your code to enter set/enter mobile number 



        End If











     


  • ajb's avatar
    ajb
    Occasional Contributor
    Thanks for responding. I was hoping to find a solution that could be implemented without using scripting.
  • Anthony, I know you don't want to use scripting, but it will make everything much easier / more customizable. Give it a try if you ever get a chance! :-)



    -Sean