I'm wondering what are the correct way to do for integration/system testing on a web form with lots of fields. I'm using ruby on rails with minitest, but it's a general design question.
Suppose I want to test a form with 20 fields, compile them all, save the form and view that all the fields are currently populated.
OPTION 1: I simply compile the form with strings and check them in the view (suppose there are lots more fields)
fill field1 with 'home'
fill field2 with 'car'
click_on 'save'
assert_content 'home'
assert_content 'car'
OPTION 2: I use a factory object,initialize it and check against it
factory = new SampleFactoryObject
fill field1 with factory.name1
fill field2 with factory.name2
click_on 'save'
assert_content factory.name1
assert_content factory.name2
I think the first way is more precise and clear, but maybe it's more prone to errors? Is there a definite way to test this?
Aucun commentaire:
Enregistrer un commentaire