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
-
Unit tests are useful (and frankly mandatory) for any kind of business logic, wherever it is implemented.
What makes them look wasteful in your eyes? -
h3rp1d3v5193y@Commodore Because react. You first need to refactor people's crap to make components testable. Then, write long and complicated tests. Finally, bang your head against keyboard every time tests break, and tests break all the time.
-
Yes, but you need to create the tests first.
If you create the tests first, you'll wind up designing functional and testable code.
If you create the code first and than try to test, you'll bang your head against the keyboard and think unit testing is a horrible idea that barely functions and breaks often. -
hoggchan7913y@Commodore I think @h3rp1d3v has explained most of how I feel. For function test I believe unit tests are helpful and worth the effort, because I just have to provide some input and check the output. It is black box testing for me.
But for component tests, I need to understand the implementation first and possibly need to mock its dependencies here and there. Besides, there will be a lot of test cases where we have many diverge paths, like, we need to mock a lot of input one after another then we can test different options after that. Then we have long and complicated tests. -
hoggchan7913y@h3rp1d3v sir, you shared the same feel as I do.
btw, what is visual regression test service? -
hoggchan7913y@lungdart Yes. I am writing tests after implementation. That's why I am wondering whether it will be totally different if we write tests first. But how do I feel for UI tests I still need to know about implementation before tests. Then we are still doing implementation before tests, virtually.
-
hoggchan7913y@Lyniven sorry for scaring you. I am trying to embrace unit tests too. But it just doesn't feel right for me. That's why I turn to the community.🥲
-
hoggchan7913yIf anyone have good practical examples of testing/TDD, in forms of video or documents, could you please share it with me? I really appreciate that.
-
@hoggchan designing test first will show you how to implement as dictionary as you can, and what components need to be tested at an integration level rather than a unit level
Related Rants
Is unit test helpful in React web app? Why do I think it is just wasting of time? How often do you use unit test in your web app development?
question
react
unit test