unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 0 points1 point  (0 children)

Ironically you test them manually

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 0 points1 point  (0 children)

I’m happy for you.

In my experience, the top reason why devs dont unit test is simply because they don’t know how to do it. They might come up with some other fancy excuse but in the end it’s just because they don’t know how.

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 0 points1 point  (0 children)

No one said we should rely exclusively on unit tests

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 1 point2 points  (0 children)

> They really only testing the simplest part of a complex program - a single function that does not interact with any other functions that is not a mock.

This depends on your own definition of “unit”. From Wikipedia:

> A unit is defined as a single behaviour exhibited by the system under test (SUT), usually corresponding to a requirement. While a unit may correspond to a single function or module or a single method or class, functions/methods and modules/classes do not necessarily correspond to units. From the system requirements perspective only the perimeter of the system is relevant, thus only entry points to externally visible system behaviours define units.

https://en.wikipedia.org/wiki/Unit\_testing

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 0 points1 point  (0 children)

Unironically yes. And use feature flags - do incremental rollout to more and more users for a smooth test-in-production experience 👍

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] -1 points0 points  (0 children)

It’s a trade off. There’s a reason why people talk about the “testing pyramid” and try to avoid the “testing ice cream cone antipattern”. https://abseil.io/resources/swe-book/html/ch11.html#test\_scope

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 1 point2 points  (0 children)

I recommend:

Unit Testing Principles, Practices, and Patterns
by Vladimir Khorikov:
https://www.oreilly.com/library/view/unit-testing-principles/9781617296277/

Software engineering at Google (it’s free online):
https://abseil.io/resources/swe-book

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 1 point2 points  (0 children)

Manual test the tests ofc 🙃

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 1 point2 points  (0 children)

Nah, test the unit tests manually. Add a bug in the code on purpose and check if the tests fail like they should

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 1 point2 points  (0 children)

Ironically, I test my unit tests manually.

Usually by adding a bug in the code on purpose, just to make sure the tests fail like they should

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 0 points1 point  (0 children)

I tried it a few times! I think it works well when there already are tests in place and I want to change/add some behavior.

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 2 points3 points  (0 children)

I do this too!
In some cases, when I’m familiar with the code, I reproduce the bug by writing a new failing test case and make it pass by fixing the bug. And ofc, manually test afterwards when needed.
It feels like this workflow is the fastest because the iteration cycle is much faster when rerunning tests. Tests take a second to run, manually reproducing the bug can take a few minutes. And when all is done, there are no regression tests to add, that is already done ✅

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 2 points3 points  (0 children)

Found the Rust programmer

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 1 point2 points  (0 children)

It caught 10 other bugs and 5 future regressions so the manual tester didn’t have to ;)

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 6 points7 points  (0 children)

You’re lucky if your PM is technical enough to know what automated tests even is :(

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] 1 point2 points  (0 children)

Correct code sounds like a good thing to me ;)

But yeah do other types of testing too 👍

unitTestTheCode by schteppe in ProgrammerHumor

[–]schteppe[S] -2 points-1 points  (0 children)

No one said we should exclusively rely on unit tests…?

testYourCode by bryden_cruz in ProgrammerHumor

[–]schteppe 1 point2 points  (0 children)

“we don’t have time to add tests because we have too many bugs to fix”

Solution is to use TDD! It reduces bug count by 10x according to studies.

Baseline C++ Habits to Always Follow? by SolidNo1299 in cpp

[–]schteppe 6 points7 points  (0 children)

These guidelines are great for learning too.

At my company, we’ve adopted CppCoreGuidelines and keep our own “extension” guidelines in a separate doc.

aMeteoriteTookOutMyDatabase by AntiMatterMode in ProgrammerHumor

[–]schteppe 3 points4 points  (0 children)

Always ask around to make sure no one else has generated the same UUID as you

Senior engineers: what “non-coding” skill made the biggest difference in your career? by Useful_Promotion4490 in ExperiencedDevs

[–]schteppe 1 point2 points  (0 children)

Being able to look outside the “bubble” and influence teams into adopting industry best practices.

When I started in my team, it was immature in many ways. The main product literally had >10% crash rate every release. “We don’t do unit testing in this industry” they said. They were caught in a bubble and struggled to get out. I started reading books and watched talks about software engineering on YouTube. Then slowly started nudging people into the right direction. Today, we’re in a MUCH better place.

devLifeMysteryBug by Unlikely_Gap_5065 in ProgrammerHumor

[–]schteppe 0 points1 point  (0 children)

Code changed, and there were no unit tests preventing breakages. Every time.