Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
ltlian2196281dPhase 1: Learning about the concept of testing
Phase 2: Thinking everything must be tested and people who don't have 100% coverage or only develop in TDD are dumb
Phase 3: Oof we lost control of our insanely complicated and bloated tests that need you to mock http contexts and a particular database vendor so we haven't used them for 5 years
Phase 4: Let's just write useful, simple, maintainable unit tests for the important bits
The trick is to not slip back into 3 when you thought you were in 4. -
Mishik9040281dTesting is hard when you don't write testable code. With time it gets fun because you get better at writing good code and then testing is fun :)
-
hjk1015731280d@Mishik90 even if you do dependency injection, focusing on unit testing will make you over abstract everything introducing unnecessary complexity and the 80% you are testing are mocks. I rather flip the pyramid and only emulate/mock external systems and focus on integration/end2end tests. That way you are actually testing the system and how is really behaves while covering a lot with a few cases.
Only where there is complex business logic unit test. This prevents exploding the integration/e2e test cases. Besides the logic heavy units usually don't have a lot of external dependencies. -
Mishik9040276d@hjk101 I do same, it's crucial to pick the right testing method for your case. If you have concrete logic you want to assure to be working in different scenarios then unit-testing is great. Everything has it's limitations and pros/cons.
I used to hate writing tests, surprisingly now I’m kinda enjoying it this time.
rant