This is a migrated thread and some comments may be shown as answers.

Null values in excel databind file

1 Answer 50 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Beckie
Top achievements
Rank 1
Beckie asked on 03 Dec 2010, 06:38 PM
Is there a setting somewhere to allow null values from a data bound file?   I have several rows of data (excel file) for creating a request in our system, some of which have nothing in some of the cells, so that no data is filled in for that field on the screen.   I know I can catch it in the code-behind, but I was hoping there is a setting somewhere to handle empty cells as empty string or some other elegant solution.  I have a lot of steps that I would have to handle in the code-behind if there is no setting.

1 Answer, 1 is accepted

Sort by
0
Stoich
Telerik team
answered on 06 Dec 2010, 02:17 PM
Hi Beckie,

   You shouldn't have any problems with Null values. Here's how it works: you can create an Excel Sheet with multiple columns, like this:

1| fName | lName     |
2| Tom     | Roger      |       
3| Dick     | Foreman |
4|              | Paul         |
5| Harry   |                  |
 
And lets say you bind a test to this excel. Your test handles a login - it writes a first and last name to two Input boxes. The two "Set Text To" steps for these text boxes are bound to the excel  $(fName) and $(lName) respectively.

When you execute this it will be broken down into 4 iterations. Each iteration will use the values from one row. The empty (null) values will be treated as simply empty - you won't get a nullpointer exception even if you don't check for it in a coded step. For the specific example shown above the four iterations will look like this value-wise:

1)  $(fName)=Tom   and $(lName)=Roger
2)  $(fName)=Dick   and $(lName)=Foreman
3)  $(fName)=           and $(lName)=Paul  --> won't write anything to First Name Field
4)  $(fName)=Harry and $(lName)=           --> won't write anything to Last Name Field

And this test run will be completely successful - so no need to handle anything. Any null values are treated as an empty string ( "" ).

I hope I've managed to answer your question please don't hesitate to contact us if there's anything else!

Greetings,
Stoich
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
Tags
General Discussions
Asked by
Beckie
Top achievements
Rank 1
Answers by
Stoich
Telerik team
Share this question
or