Ask a Question

Data driven data with blank optional fields

Occasional Contributor

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?

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


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! 🙂

I’m not a member of the SmartBear Support Team, I’m just helping users in this community. Any views or opinions expressed do not necessarily represent those of SmartBear Software.
SmartBear Alumni (Retired)

Hi Anthony,


Are you taking part in our DDT webinar? Maybe this question will be discussed there.


Tanya Yatskovskaya
SmartBear Community and Education Manager

Showing results for 
Search instead for 
Did you mean: