I do not get this all recommandation to test everything. Its a failure, I have learned myself from practice and from one book, from other devs. I even know one succesful dev who does not test at all automatically. It is weird that book with word "pragmatic" recomemnds this: "A Test Is the First User of Your Code"
in some cases only it is/can be true. Otherwise you just spend a ton of time.
Really some things are relatively simple and hard to break. But writing tests costs a lot. Plus some things - even if broken, they are quickly noticable by using the application, or while testing other things.
Some things do not cause much damage to the business even if they are broken. I remember linkedIn example - some time ago there were so many bugs in it, I could see them easily. But it was just used, they focused on features probably. And now the bugs are fixed and linkedIn is not dead. So need to think before - where is the time needed to invest. I really would be afraid to test everything now. Also when I do some simple projects for my own, I practically never write tests. If at some point they would generate me money and could cause lot of loss when they work incorrectly, then it would make sense to add tests to them. Now most of my side projects are just dead. So whats the point have been to invest time into tests? It is really not pragmatic to test everything. It actually teaches you wrong thing. Because I also learned from books like this to test everything and did worse at my carreer when I tried to act like this.
I would write tests for everything if if whole team would be valued for doing this. Like some team lead would tell to do this and everyone does this, then it would be responsibility of team lead, I would not be guilty for wasting time and it would not put me at the disadvantage when compared to those who do not write tests or write less.
"We see a major benefit in TDD for people just starting out
with testing."
And this is especially bad. Again - in some cases TDD can work. But usually it is like 1 % of the cases. Maybe more if you test simple api CRUD methods with end to end testing, or functional, I do not know how it is called exactly but it is not unit test. But again learned that I do not need to test simple things. The code changes so much when developing and unit tests break constantly and you are wasting the time.
Oh I see later they talk bad about TDD:
"However, we’ve also seen people become slaves to TDD. This
manifests itself in a number of ways:
They spend inordinate amounts of time ensuring that they always have
100% test coverage" - exactly what I was talking about.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I do not get this all recommandation to test everything. Its a failure, I have learned myself from practice and from one book, from other devs. I even know one succesful dev who does not test at all automatically. It is weird that book with word "pragmatic" recomemnds this: "A Test Is the First User of Your Code"
in some cases only it is/can be true. Otherwise you just spend a ton of time.
Really some things are relatively simple and hard to break. But writing tests costs a lot. Plus some things - even if broken, they are quickly noticable by using the application, or while testing other things.
Some things do not cause much damage to the business even if they are broken. I remember linkedIn example - some time ago there were so many bugs in it, I could see them easily. But it was just used, they focused on features probably. And now the bugs are fixed and linkedIn is not dead. So need to think before - where is the time needed to invest. I really would be afraid to test everything now. Also when I do some simple projects for my own, I practically never write tests. If at some point they would generate me money and could cause lot of loss when they work incorrectly, then it would make sense to add tests to them. Now most of my side projects are just dead. So whats the point have been to invest time into tests? It is really not pragmatic to test everything. It actually teaches you wrong thing. Because I also learned from books like this to test everything and did worse at my carreer when I tried to act like this.
I would write tests for everything if if whole team would be valued for doing this. Like some team lead would tell to do this and everyone does this, then it would be responsibility of team lead, I would not be guilty for wasting time and it would not put me at the disadvantage when compared to those who do not write tests or write less.
"We see a major benefit in TDD for people just starting out
with testing."
And this is especially bad. Again - in some cases TDD can work. But usually it is like 1 % of the cases. Maybe more if you test simple api CRUD methods with end to end testing, or functional, I do not know how it is called exactly but it is not unit test. But again learned that I do not need to test simple things. The code changes so much when developing and unit tests break constantly and you are wasting the time.
Oh I see later they talk bad about TDD:
"However, we’ve also seen people become slaves to TDD. This
manifests itself in a number of ways:
They spend inordinate amounts of time ensuring that they always have
100% test coverage" - exactly what I was talking about.