siniom.bsky.social
@siniom.bsky.social
Forgot to link the video! I might not agree, but as always, it is a good one. Thanks for giving me something to share my opinion on @t3.gg! 😁

www.youtube.com/watch?v=FF50...
The ONLY REASON To Unit Test
YouTube video by Theo - t3․gg
www.youtube.com
April 16, 2025 at 3:41 PM
Some of my thoughts around this came from the book "Refactoring - Improving the design of existing code" martinfowler.com/books/refact... where the author uses unit testing as one tool for making good refactors.

Do you agree? Do you not?
Refactoring
martinfowler.com
April 16, 2025 at 3:38 PM
Of course, we have to test the implementation for real by using real cars and real circumstances. But by thinking about all these issues, and making my code be ready for them, my code is now better.
April 16, 2025 at 3:38 PM
the car should stop whatever it is doing immediately. By having a test, that can bombard my function with some weird ass data or edge-cases or the connection being broken or whatever it may be, and see that those tests pass. That at least makes me feel better about my work.
April 16, 2025 at 3:38 PM
5. Safety and making my code better. I'm working with apps that can send remote signals to cars that makes them do stuff. Lets say a finger has to touch the screen within a certain area, if it goes outside that area or the fingers connection to the screen is broken at any point,
April 16, 2025 at 3:38 PM
4. Handover. By having tests, I can sort of show a checklist of things that my app actually does, and it is proven to do.
April 16, 2025 at 3:38 PM
(.... I feel sometimes like there is probably another way to do this to? But so far, this is the method I have been taught and learned. ) By having unit tests, I still have to spin up a simulator, but the functions input and output can be tested immediately and are much faster.
April 16, 2025 at 3:38 PM
3. At least in my field, (Native iOS Development) the code executes in the iPhone simulator. Spinning that up, going through screens to find the functionality I need, takes time.
April 16, 2025 at 3:38 PM
I can make sure that my inputs are curated, and my outputs are what I expect... through the whole chain. By running the test through the debugger it might be faster to run the test, than trying to create a scenario where I reach the code.
April 16, 2025 at 3:38 PM
2. Sometimes I might even use a test to make sense of a new codebase I'm trying to understand! Either by reading a test that is already created, or creating a new test that tests code I'm unable to wrap my head around, yep I know == skill issue...
April 16, 2025 at 3:38 PM
1. For the sake of refactoring. Sometimes, I refactor a lot. Especially for code simplicity and clarity. When doing that, for me, it feels really nice to be, at least, pretty sure that the code is still doing the same as it was before.
April 16, 2025 at 3:38 PM
(Yes... I know, it seems like I'm part of a dying breed of devs, and I feel like I just started 😅. I'm actually quite concerned about it.... You dont think ios app developers are doomed? HMU! :D... aaaaanyhooo. )

These are some of my main use cases for testing:
April 16, 2025 at 3:38 PM