4 ms·
I do a lot of ui stuff and the sort of test I'd write for say a form and a save button would be: 1) populate the form with invalid data, click save. Verify tha
by LandR 8y ago
I do a lot of ui stuff and the sort of test I'd write for say a form and a save button would be:
1) populate the form with invalid data, click save. Verify that I showed an error message and it was structured how I want it. Verify I didn't call the database save.
2) populate the form with valid data, click save. Verify no error was shown, verify we called save on the dB layer and that the model we passed to save was as expected. Verify we showed the user a confirmation.
3) if we have required and non required fields, a test to verify each required field is actually required. If its not required verify the correct defaults are used.
4) if we are passing messages on save yo update other ui forms, then verify the message was sent and the underlying object or collection on the other ui element is updated with expected values.
I would expect these tests to run on every build, and on your dev machine on every save.
Otherwise you are just hoping devs arent breaking stuff... And hoping they test each case. Which for even a trivial form can be numerous. I'd definitly want this automated!
- war1025 8y agoI also write those sorts of tests. I just write them after I am happy with the way things are working. Like I said, tests have their place. When to write them is just personal preference.