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
-
Nope. But in TDD, you will write a code that will check the code that you “will” write.
-
@masterlei yeah true. This joke is taking it to a deeper level. Write test cases to validate the test you wrote 😂
-
Yeah... In my current project, the first thing I did was translate the concept to RSpec tests - the first time I ever did that.
Turns out real well, MVP in 5 days...
Then the project manager changed every fucking little detail, back and forth like a racoon on Crack...
Yeah, after that and with the time pressure on, TDD my ass it was. Again.
Guess a certain Project manager needs a beating. -
sceiler716yNope. My coding is too ad-hoc and unplanned to do that.
But we have used sonarqube and for the fun of it we enabled it for test projects too. As a result the coverage went down because the tests weren't covered by tests. Off to write tests for the tests and the cycle begins anew. -
Too bad lots of the tools for TTD are still terrible and require lots of repetitive code to work. It should not require 75% of my time
-
matste6416y@Martinspire
Writing tests is hard. I don’t think, you can ever go below 30%. Especially, when you start a new module/project, you spend a lot of time setting the test framework up. BUUUUT In most projects, 75% of your time is worth less than the cost of multiple people reporting, coordinating and fixing a stupid bug.
Any experienced software manager will prefer slower developer over a fast one who produces a lot of problems.
I like to write tests, because the first junior who touches my code in the future will break it and this will be my fault. -
Tests are usaully much simpler programs than the program being tested. So there is really much less chance to introduce and then miss a bug in the tests entirely and good tests are really really useful. You might think writing tests takes up 75% of your work but thats just because without writing tests you would spend a lot more time with manual testing and debugging.
-
@sudipbhandari
We always write at least some experience-based tests. No framework, its really not that complicated...
Say you want to test a function/program, first you just make up some input data and define the expected result (return value, check some variable, threw exception?) and then you write a tiny program (the test) which calls that function with the input parameters and if what happens matches the expected result, the test passes. Then you probably want some script which runs all of your test programs after each build so that you catch bugs as soon as they occur. -
I feel the same way when manager asks me to write test cases to test "flow of code(his words) "... I use mokito, but sometimes hate this part of my job! 😑
-
Crost40746yIf you do t write tests how can you release something without shooting bricks for the next week solid from nerves?
-
EVERY time I considered doing real TDD, this thought entered my head and I just couldn’t bring myself to do it.
-
I mostly don't follow TDD strictly, but I strongly believe that writing tests should be a fundamental task for every professional software developer.
Why? Because it will enable you to refactor your code, and to add new functionality without breaking things. So, adding tests (and, mind you, _fast_ tests) is an investment in the quality of your product.
Having said that, adding tests for trivial functions is a waste of time. In addition, enforcing a certain threshold for the test coverage is stupid and may in fact be harmful.
Regarding "testing your tests": mutation testing is what you should do ;) -
@w4tsn
Most of the checking actually is done by the compiler - if your code is in OCaml... -
purplehaze01yI have been trying to figure out if there's a way to train an AI model to write tests for me as I write out my APIs. Anybody else who's tried this?
Related Rants
Do you follow test driven development?
joke/meme
tdd
programming
test
unit-test