Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
alexbrooklyn15027262dNothing is set in stone, whatever fits the workflow or the situation.
jiraTicket1007262dGUI tests don't have to be hard.
input: fake api-data for article
output: rendered HTML page for the article
test: check if the H1 has the specified title.
That's easier than testing a viewModel - which might require you to restructure your code into testable units.
The harder part is if you have interaction or multi-part flows like three step form where you click a button and after 0.3s a modal pops up.
jiraTicket1007262dI think the value of end-to-end tests is far greater than unit-tests.
The obvious benefit being that unless your test covers the view rendering it's not worth a whole lot - who cares if the model has a title if you forgot to output the title in the view.
Another thing is: test readability.
If I look at someone's unit test, there's a bunch of internal structures which I might not be familiar with.
But if I look at someone's end-to-end HTML test I can see what they're testing for. I can compare it to the production site. I can even paste the result into a browser and take a look to visualise it.
jiraTicket1007261dBoth are of course nice to have but I'd easily prioritize pic end-to-end tests if I had to.
Often we can get away with not testing every other brick - just the ones which are load bearing. 😏
I always test a units which are extra complex: like tests for a regex are a given.
But in general I find that most of my errors don't occur in individual functions, but rather in the way they use each other.
craig9393933354261d@jiraTicket I disagree but to each their own.
My reason though is that unit tests don't just prove working code, for me that is secondary. They're about refinement, refactoring, documentation, clean black box design, clean code if used correctly.
Difficult to read unit tests are not clean. Unit tests should be of the same high quality as the rest of the code base, and in my opinion they should be written in abstract steps.
End to end tests solve a completely different problem for me.