I am somewhat new to writing tests and I want to build that habit into my workflow. So for example I might write a test that a user can create a blog post however I'm not sure on how to do that effectively.
Should I have a test case to verify that every field is validated?
By that I mean I could either only write one test case like :
testThatUsersCanCreateBlog
or...
testThatUserCanCreateBlog
testThatUserCannotCreateBlogWithoutTitle
testThatUserCannotCreateBlogWithoutTags
testThatUserCannotCreateBlogWithoutImage
etc....
Now the first approach seems kind of useless because I'm just going through the "happy path" so I'm not really testing anything but the second approach feels a bit invasive because I feel like my test becomes a burden instead of an asset.
I've heard that in theory a test well written should not need to be changed every time the tested item is changed but in the 2nd instance if I add or remove fields to the Blog
model then I am required to make the same adjustments in my test to keep it consistent so it doesn't throw up an error.
With extensive forms of 20+ fields on ~50 pages this picture looks wrong somehow. Am I missing something?