I have Web Registration form with 10 Text-Box Fields,

Question 1 -
How to create TestData and write Data-Driven script?

Answer/Approach 1- Create different Data for each and every Testcase of each TextBox fields, i.e I may have to write same data for 10 times(say for checking Max length)
e.g - My TestData will contain following Columns
1) TestCase No
2) TestCase Descriptiopn
3) TestData
4) Expected Result

I will repeat this 10 Times i.e for every field.

And also I will have to write some-what same script for 10 times

Answer/Approach 2- Write reusable functions for same Testcases of fields, so that i don't have to repeat TestData

I will create one generic function for checking max. length which will accept object name, max.length and Based on Max Length my function will create TestData

And My TestData will contain following columns

1) Object Name
2) MaxLength

*I can repeat it for many properties of the object

*Which is more suitable and Practical or any other Approach?


Question 2- How to Design Test Script, means should I write different Testscripts for every field?
what I am thinking is- I will write 1st TestScripts at Field Level(like for Name, Address) then at Combination of Field level (like Age and Registration/Birth Date) and then at Form Level(like Can Not Submit Blank Form, etc.)

*Which is more suitable and Practical or any other Approach?