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
Search - "unit-tests"
-
My morning:
Me: Why did you just delete the failing unit tests?
Intern: I debugged it for a while and found one of the other developers broke it with his recent changes. I couldn't fix it.
Me: Did you let him know he broke it?
Intern: No.
Me: So you just deleted it and decided to pretend the feature isn't broken?
Intern: ... No ... I mean ... well you told us yesterday we needed to have all the tests passing.
(I NEED a stress ball people)30 -
Working with a team of interns, pointed out a bunch of unit tests are failing, they said they would take care of it.
10 mins later they opened a pull request to delete the tests that were failing.
fml, fml, fml, fml ... and ... oh yeah fml10 -
Not writing unit tests.
Everyone reading this is guilty of it.
Anyone who says otherwise is lying.23 -
Sometimes I'm lazy and if I'm writing unit tests and there's a complicated case to test I'll just skip it.15
-
So what does everyone think about unit tests, do you do it?
My own experience is I've seen people on my current team disable failing tests...12 -
Reviewer: your pr has unit tests
Me: yes
Reviewer: well, we never had unit tests, this is kind of an issue, not sure how to handle this right now
return "LOL"8 -
* Updates and adds unit tests *
* Runs unit tests *
* All tests pass *
What the fuck? I'm not THAT good to write tests that pass on the first iteration.
* Runs unit tests *
* All tests pass *
Someting's not right here.
* Checks terminal *
FUCK I'm in the wrong project folder2 -
How to quit smoking as a developer, tutorial:
#1: You're only allowed to smoke when every unit test is passing.
#2: ???
#3: Profit5 -
All my unit tests work, all my component tests work, why the FUCK does it give me a 'Verification Failed' error?
1 hour later:
Oh wait this is the wrong public key2 -
People who try to justify not writing unit tests are the same as those who try to justify not using a condom.
You'll be sorry later.4 -
One component is used over 30,000 times. How many unit tests do you think we have for it? Zero. Fucking zero, Zip, Zilch, Nada, None.
WHAT THE QA FUCK!?6 -
Saw this from a friend of a friend of a friend and made my own meme.
2 unit tests 0 integration tests. Hacky code to fix it.3 -
I was asked by our tester and scrum master to ignore some failing unit tests yesterday. The tester literally said "no time for tests, we need the build now". The scrum master is also a tester and agreed. I dont think I can respect either of them as testers anymore.3
-
I now know why people don't write tests.
Been trying to get started with React unit tests for weeks now.
Hope Driven Development FTW.9 -
Some former colleague just blatantly commented out units tests I wrote for his build to pass. What the...7
-
My co-worker not only doesn't create unit tests, he comment out my own unit tests after he changes the code and the test breaks.11
-
Personal Project:
Code lives in gitrepo, commits to master are automatically unit tested and if all tests work it will be published to production
At Work:
"If you're done put this .bat in the project folder, it will copy everything in it per ftp to production"1 -
"We don't have time for writing tests"
"Yeah we could write them but only if the client paid us for that"
"You can just test new features manually!"
- Most devs of our mobile team.
Every day they're fighting with bugs and when they're fixed, a couple more pop out of nowhere.
Dear god help me.5 -
"I'm almost done, I'll just need to add tests!"
Booom! You did it, that was a nuke going off in my head.
No, you shouldn't just need to add tests. The tests should have been written from the get go! You most likely won't cover all the cases. You won't know if adding the tests will break your feature, as you had none, as you refactor your untested mess in order to make your code testable.
When reading your mess of a test case and the painful mocking process you went through, I silently cry out into the void: "Why oh why!? All of this suffering could have been avoided!"
Since most of the time, your mocking pain boils down to not understanding what your "unit" in your "unit test" should be.
So let it be said:
- If you want to build a parser for an XML file, then just write a function / class whose *only* purpose is: parse the XML file, return a value object. That's it. Nothing more, nothing less.
- If you want to build a parser for an XML file, it MUST NOT: download a zip, extract that zip, merge all those files to one big file, parse that big file, talk to some other random APIs as a side-effect, and then return a value object.
Because then you suddenly have to mock away a http service and deal with zip files in your test cases.
The http util of your programming language will most likely work. Your unzip library will most likely work. So just assume it working. There are valid use cases where you want to make sure you acutally send a request and get a response, yet I am talking unit test here only.
In the scope of a class, keep the public methods to a reasonable minimum. As for each public method you shall at least create one test case. If you ever have the feeling "I want to test that private method" replace that statement in your head with: "I should extract that functionality to a new class where that method public. I then can create a unit test case a for that." That new service then becomes a dependency in your current service. Problem solved.
Also, mocking away dependencies should a simple process. If your mocking process fills half the screen, your test setup is overly complicated and your class is doing too much.
That's why I currently dig functional programming so much. When you build pure functions without side effects, unit tests are easy to write. Yet you can apply pure functions to OOP as well (to a degree). Embrace immutability.
Sidenote:
It's really not helpful that a lot of developers don't understand the difference between unit, functional acceptance, integration testing. Then they wonder why they can't test something easily, write overly complex test cases, until someone points out to them: No, in the scope of unit tests, we don't need to test our persistance layer. We just assume that it works. We should only test our businsess logic. You know: "Assuming that I get that response from the database, I expect that to happen." You don't need a test db, make a real query against that, in order to test that. (That still is a valid thing to do. Yet not in the scope of unit tests.)rant developer unit test test testing fp oop writing tests get your shit together unit testing unit tests8 -
*Tells people I don't have a religion and I'm a free thinker*
*Refuses to use 666 in my unit tests because I am not letting satan to possess my unit tests*5 -
My new start training at my current place of work.
Learned how to use Linux, terminal, ssh, git, MySQL, how to create basic web apps with Spring, how to write unit tests and UI tests. All in the space of 4 weeks. Best training I have ever been on.3 -
Unit tests fail.
Re-ran it again without looking at details.
Unit tests pass now.
What. Why?!
Now I can't sleep at night.6 -
I finally stopped being lazy and wrote 31 unit tests for my Discord bot.
Nothing is more satisfying than seeing them all pass and the GitHub workflow working without any problems. :)8 -
A while back I feel asleep on the couch on the day of the state of the union address.
My deadass mind heard someone asking what the "state of the unit tests" was and I leaped up and said "there aren't any! i'm sorry, it's only a small project anyway".
Thank god no one else was there... 😂 -
Me: I think we should implement some kind of unit tests.
Lead: No time everything will take twice as long.
* some of my code accidentally breaks some of his *
Lead: I think we should implement some kind of unit tests...4 -
Do you know that feeling when you finally have no more errors, but then you can't tell if the software actually does the right thing?
🤢
Wisdom of the day:
'No crashes' is not equivalent to 'it works'...5 -
I just wrote 80+ lines of tests for a 30 line module and I was really mad at myself for wasting my time like that, until I remembered that while writing those tests I did actually catch several really tricky bugs and it didn't even take that long.5
-
I love it to maintain old unit tests which were not executed for about 5 years. 2/197 are green (╯ ͠° ͟ʖ ͡°)╯┻━┻4
-
Just joined a new team at the organisation as senior dev.
Team lead keeps singing about how we need unit testing and good standards.
I implement domain pattern on the backend supported by unit tests.
It passes QA and then get an earful about the code not being 'restful'. What does that even mean?
Well, it matters not since team lead changes the whole feature in the release branch and all unit tests obviously fails. Builds start to fail.
The solution? Comment out all unit tests. In the sprint retro, we hear the same old adage 'we need 80% code coverage'
Do as i say, not as I do. FML.6 -
Once during a standup, I mentioned that I needed to fix some unit tests before the build would be ready. Our tester then said "no time for tests, we need the build now". That was a dark day.
-
How to NOT write unit tests:
A colleague of mine has developed a new package of software, many of our new projects are going to use. So in his presentation of the new functionalities he also showed us that he used unit tests to cover some of his code. So i asked him to show me that all tests passes.
He: I can show you, but one test suit will fail currently.
Me: Why?? You told us, everything is finished and works fine.
He: That's right, but they will fail because I'm currently not in the customer VPN.
Me: Excuse me, WHAT??
He: Yes, I'm not in the VPN that connects me to this one customers facility in Hungary, where the counterpart of the software is runnung live.
Me: YOU WROTE UNIT TESTS THAT TEST AGAINST A RUNNING LIVE FACILITY??
He: Yes, so I can check, that the telegramms I send are right. If I get back the right acknowledgement, the telegramm structure is right and my code is working.
Me: You know, that is not the porpose of unit tests? You know, that these test should run in any environment?
He: But they are proving, that my code is working. Everytime I change something I connect to the customer and let the tests run.
Me: ...
Despite the help of some other developers we could not convince him that this was not good and he should remove them. So now this package is used in 2 new projects and this test suit is still failing, everytime you execute all unit tests.7 -
Read source code and unit tests. Don’t bother documentation cause it’s outdated. Dig into the core, look where data goes in and where it gets out. Everything else is just a wrapper.6
-
God: you qualify for reincarnation. What advice from past life do you want me to retain in your memory ?
Me: never forget to write those unit tests!2 -
* Ctrl+Shift+F to find all "assert" in solution...
Matching lines: 0 Matching files: 0 Total files searched: 1504
* Bang head on table
* Flip Table
* Start writing unit tests -
In my team, unit tests are called so, because every Dev is a 'unit' who manually tests their own code...
-
The fucker complains when someone doesn't write unit tests, meanwhile he tops any new code he writes with a @codeCoverageIgnore annotation ... 😒😒7
-
When you're writing unit tests in xcode and it crashes and loses its syntax colouring and autocomplete. All of a sudden you're coding on textedit instead.2
-
i should be writing some unit tests for a customer project, but i brought my new nintendo switch to work and there is nobody else in this room... :D4
-
Finally found a client who thinks TTD and unit tests are useful ways to spend development budget.
Still expecting to wake up.3 -
"Coding se darr nahi lagta Sahab, Unit Tests likhne se lagta"
"Coding doesn't scare me Sir, writing Unit Tests does"
As a fresher, UTs scare me.5 -
How to force your self to write unit tests for your personal projects:
1. Go to a public place
2. Forget to bring your phone cable & never install a simulator because you are lazy af
3. Profit!4 -
Yeah, hiring people solely to write unit tests is a completely reasonable thing to do, i mean, its not like unit tests are a perfectly repetitive task that could easily be automated or anything...5
-
Nobody Unit Tests.
So it's already 1:15am late night and I am all tucked up in bed watching Roy Oshrove talk on unit testing and ways to write correct unit test. My friend walk in and finds me in bed watching this. He seems surprised as what are you doing ??
I replied it is an interesting talk on unit testing.
He says are you mad? Who the hell does unit testing ?
People out there are spitting on unit test code base. And they don't write unit tests.
Nobody unit tests.!!
I stay calm. I know there is no point of arguing. I said I'll sleep in some time.
And he works as developer, a job that I applied an never got because of connections.
I am optimistic someday I'll find a job that I deserve. The developer world is in danger. !!!4 -
Maybe in special dedication to @kiki.
I cut the unit tests down in LOC size by roughly 50 - 60 % in most projects.
It's really easy once one sees unit tests not as a dunking pile of copy pasta wild west, but rather as a code base that needs architecture and design.
Some extensions, some annotations, some good old helper classes.
Pooooof.
Why I did this? ...
Because it's fucking annoying when you read a PR with tests and need a fucking diff tool to spot the difference between two tests cause they're 80 % the same.
Yeah. Thx for giving me brain cramps, motherducker.
I'm not an expert in unit tests, but if all test codebases look like the "usual stuff" in our projects...
It's no wonder bugs exist...10 -
"We've refactored most part of the code to follow best practice. Many of the unit tests are broken. Please help us to fix them all".
Me: Oh joy!!!5 -
When the devs "fix" the unit tests by modifying the test cases so they pass.... Bugs are still there, but our deployment succeeds now. Oh federation....1
-
I have 2695 unit tests in current project.
Most of them are useless but you still need to maitain them....10 -
We have a production release tomorrow and we didn't have any kind of testing other than the unit tests we wrote. 💣💥🤯🎆3
-
I had no idea of how to implement the logic of a ticket. That's why I started with creating some unit tests that failed. Then I continued working until they all passed.
So it works now.
I have still no idea of how I implemented the logic.3 -
Boss: "we're going to take over a project from another company. that's what we know so far - any other questions?"
Me: "do we get the history (svn/git) or just current source? unit tests?"
Other company: "no history for you. no unit tests - app was only tested manually"
Me: *sigh* :'(3 -
Getting beaten up over the quality of an app i'm working on with 6 interns. We have a bunch of unit tests, was shocked to see so many issues ... until I looked at the tests.
A function returning a non-optional array has 1 check ... that the return value is not nil ... fml3 -
IHateForALiving: gentlemen, my unit tests are randomly falling. Sometimes the login procedure just fails for no apparent reason, did any of you encounter this problem?
The very fucking smart colleague®: DID YOU REMEMBER TO PLACE YOUR AUTHORIZATION HEADER
Of course
The authorization header.
To fucking log in.
Because you have to be logged in before you can log in.
That's the standard, of course.3 -
delete unused code according to IDE
unit with context tests now fail
what is a good alternative industry or career instead of software development8 -
The "unit" in unit test does not mean your ENTIRE APPLICATION. Ever heard of scope!?
I am amazed how often people write overblown test setups, mock hundreds of unrelated services, just to test one tiny bit of logic.
That bit of logic could have been a pure function.
For that pure function you could write a dead simple unit test. Given that input, I expect that output. Nothing more, nothing less. (It helps even more if the pure functions only accepts primitives, like string and numbers, or very simple immutable value objects).
No I don't care that the service is used by another service, as your mocked interaction also doesn't test the service as a whole but you just assume the happy case most of the time anyway. You want to test the entire application? Let's not use unit tests for that but let's use a different kind of test for that (integration test, functional tests, e2e-tests).
If you write code in a way that easily allows for unit testing, your need to mock goes away.rant unit tests test all the things tests you are doing it wrong tdd testing don't mock me unit test1 -
Don't test complex functionality before production.. neither unit, nor system tests involved for my android app. Releaseing solely based on hope!2
-
Not learning unit testing... I've heard so many good things about them, but I've never learned how to inple.e t and use them.
Maybe I can start now, can anyone point me in the write direction?4 -
*Completes unit testing training*
*Achieves fresh perspective*
*Looks at game code*
*Prepares to right unit tests for that problem method*
*Stares at code as crickets chirp*3 -
Don't reuse your fixtures!
Each test case should be isolated. Don't ever think just because some function requires a similar input, it's safe to reuse it ALL OVER THE PLACE.
Why? Because someday, you want to change one functionality of one unit.
And you adapt your tests, fix your code, and suddenly, by changing one fixture, you break dozens if not hundreds of unrelated tests and now you have to clean up that mess.
It's even worse for functional tests with all those interwoven parts so that it becomes hard to reason about the scope of your tests when lacking proper documentation.
How I know? BECAUSE I AM CLEANING UP YOUR MESS RIGHT NOW!3 -
When I was a junior engineer I used to hate writing unit tests but now I look forward to writing them.
Well written Unit tests will save your life6 -
My boss: Write unit tests for this angular app
Also my boss: what do you mean it will take months to write the necessary mocks for our 177 specs
Also also my boss: why would you need to mock anything for a unit test
Also also also my boss: Just let each component import all the other real components, nevermind that that's an integration test and not a unit test8 -
No, my friend, you shouldn't put all the methods into a View Controller. Also 4000 lines in a method seems also a bit too much. No wonder you hate unit tests.
-
Before i found out about unit tests i'd create a console application where i'd test the functions
Good times -
I'm going to start cutting off hands if people don't write unit tests...it's like eating your vegetables folks...2
-
Today I got a reply to a PR comment from a coworker literally stating that "it's not a good practice to add unit tests to hotfixes".
I can't, just can't. Left me speechless. Wonder where this guy gets his "good practices" from.7 -
Cold as fuck in my flat
i don't want to write these unit tests
RRRAAAAAAAAGSFGGDDFGFDSA SAFSA SVA11 -
When a bunch of unit tests start failing locally because the AWS secret key got rotated.
oh wait...
THOSE AREN’T UNIT TESTS!!!
Unit tests do not depend on any external system, that includes AWS...
AAARRGHHHHH1 -
Guys...
It has come this far...
I... I like test driven development and the amount of unit tests and security it gives you. And I kinda laugh at people that don't take unit testing seriously :p35 -
The boss wants to improve the QA by introducing GUI tests (partially non-automatic) instead of refactoring the legacy blob of application with unit and integration tests.
THIS WONT MAKE IT ANY BETTER1 -
Noobie moment with spring, wondering how the fuck to get unit tests to work in spring... might help if I put them in the tests folder...2
-
"Manual testing is often quick and easy and satisfying – you can directly test your application, one can see the results immediately on your screen, and one can interact with the application “for real”, instead of in the sometimes-awkward scripted/mocked mode of unit tests. It’s a very natural instinct.
However, it’s also largely-wasted effort! A manual test only verifies the current state of the code base. As soon as you make a change, you’ve started to invalidate the results. If, however, you take the effort to encode the test in code as an automated test, it continues to be valid indefinitely into the future."
https://blog.nelhage.com/2016/12/... -
There is how you think a system works, and there is how it actually works. Unit tests help keep those two ideas in sync with each other7
-
Fuck me why do my unit tests pass with garbage input.
I can't go into a long weekend with this shit in my head rent free.3 -
probably every time I see my tests failing.
Each time I am writing tests I'm convincing myself "it's an investment", "spend 2 hours now to save 2 days later", "unit-tests are good".
And each time I'm chasing away ideas like "perhaps they are right, perhaps writing unit tests is a waste of time..", "this code is simple, it should ever break - why test it??", "In the 2 hours I'll spend writing those UT I could build another feature"
Yes, it is terribly annoying to write tests, especially after writing the production code (code-first approach). Why test code that you know works, right?
But after a few weeks, months or years, when the time comes to change your feature: enhance it, refactor it, build an integration with/from it, etc, I feel like a child who found a forgotten favourite candy in his pocket when I see my tests failing.
It means I did a very good job writing them
It means it was not a waste of time
it means these tests will now save me hours or days of trial-and-error change→compile→deploy→test cycles.
So yeah, whenever I see my tests fail, I feel warm and fussy inside :)2 -
all that decades spent on debuggers, strict typing, static analyzers, fucking unit tests
ima put frogs in my code so they eat bugs
S̸ ̶T̶ ̵O̴ ̴N̵ ̶K̶ ̸S̷ -
That joy of finally having them all passed.
I had stupid mistakes like: insertNewItem, but inside I use update T_T
project still fairly new, but this time I decided to write unit tests as I go instead of delaying till the end and writing nothing lol -
Fixing unit-tests that expects 2017... kills my motivation at first workday this year.... I hate my coworker -..-
-
Too much technical debt
Write more unit tests
Unit tests failing, the code will be right so change the tests to pass
Too many unit tests to maintain, they look a lot like technical debt
Remove unit tests to reduce maintenance overhead -
Spent fucking 11 hrs on fixing a stupid bug in Laravel that caused all my unit tests to fail. Just because that unit testing method has no unit test...
-
Somehow, a contractor left with all our unit tests six months ago. I just inherited this project. It's 200kloc of Django spaghetti, and I have no unit tests.5
-
Typical Git work flow on a feature branch:
Commit#1 : The silly feature itself that took 10 minutes to code
Commit#2 : Added unsaved files
Commit#3 : Fix unit tests
Commit#4 : Fix
Commit#5 : Fix
Commit#6 : Fix
Commit#7 : Various Fix
Commit#8 : Added unsaved files
Commit#9 : Merge
Commit#10 : Fixed unit tests
Commit#11 : Code Review tasks
Commit#12 : Revert- Code Review tasks
Commit#13: Refactor part 1
Commit#14: Refactor part 2
Commit#15: Deleted unit tests
Commit#16: Added checking for null
Commit#17: Completely different feature's bugfix
Commit#18: Code review spacing corrections
*Approved*
Trying to merge, then merge conflicts.....2 -
After finnishing all functionality defined in koncept our boss said that we should write some unit tests.
Wrote first one and already found 2 bugs.
I guess we should start with tests earlier 😅😷3 -
That feeling when your newly added calculation module now has 93% code coverage in unit tests, with the client working on a test case for the last bit.2
-
git stash pop'd on wrong branch, hadn't realized it until after a bunch more work. Then continued screwing things up and unit tests are failing.
This is not a good coding day. -
your colleague says "i've fixed those broken unit tests".....
Double checked the dictionary, skip doesn't mean fixed!! -
When I have to ask the same person in the team for the hundredth time why they didn't run the unit tests before pushing 😞
Then eventually get them to setup system that prevents merging with broken tests themselves, but they do it in such a way that still lets them get away with pushing broken tests 😡3 -
they say kiki get your legs from position: fixed to justify-content: space-around, but they show up with unit tests, and all they're gonna get is display: glock.3
-
Assertequals("Fail","Fail") in the catch block.
Things developers do to bloat their test coverage at my organisation,
I am #stuckWithIdiots
Management sees green1 -
*class ends, close laptop*
Ten hours later (right now)
Me: 😶 can't remember why these unit tests failed... Let's run again and see why.
*build success, runs more test cases and tests, all builds fine*
Best feel ever 😎1 -
Not leaning on unit tests. I usually write them after testing my code manually, and lose time for testing feature by hand.1
-
Finally starting to write unit tests for this Java library I'm working on, and I'm wondering why I didn't do this sooner.4
-
Wrote some unit tests to check for 404 errors that called a fake endpoint key...
Months later create that same endpoint key for unrelated reasons and spend a half hour trying to figure out WHY ON EARTH the 404 tests are all failing...
🤦♂️1 -
I've been writing unit tests for an existing project for a couple of months now. I'm not experienced at automated tests, so I'm not sure what's good unit tests supposed to be, but the unit tests that I wrote basically just confirm the flow that already implemented, which to my limited understanding of unit tests is supposed to be the other way around. The good thing is that I could catch some minor problems with the implementation such as not imported class used, the wrong variable used since the project is a rewrite of legacy code so a lot of copy-pasta, I also have to wrap some part of the code that interacts with the filesystem in a DI class so I could test that part.1
-
Changed one line and had to fix over 1300 unit tests. Damn! Each has its own configuration. Been a long 6 hours5
-
so what's on the list for today? writing unit tests for a broken php app because NO ONE THOUGHT TO WRITE THEM BEFORE HAND.......
-
This is just a sweet little harmless block of code, why should I unit test it?
3 months later...
Bug in production : This is why. -
I'm so sick of "senior/lead" developers pretending they know how to write tests and ending up with these unmaintainable test suites, full of repetitions and incomprehensible assertions.
You should take some time to learn from your mistakes instead of just continuing to write the same shitty tests as usual!!!
Every time I arrive at a new team I spend weeks just trying to understand the test suites for what should be fairly SIMPLE applications!
UNIT TESTS SHOULD TEST UNITS OF CODE!
If your unit test tests seem to be repetitive, they are not unit tests. Repetition is expected in integration tests, but that is why those are usually DATA DRIVEN tests!!!14 -
When your project has no unit tests and you just accept that it's non testable anyway. Especially because the company won't put any effort into making a test environment for it.1
-
Me 🤗"Since you know the domain far better than me, can I ask you to help me understand if I managed to cover all the edge cases with these UNIT TESTS?
😒" no no no, you don't need to check for those cases, you already do that in your code"
🤗 "I'm sorry, I must have explained myself badly. I have written these UNIT TESTS exactly to ... TEST if those CHECKS in my code work and what I need is you to tell me if there are additional cases ..."
😫"but you don't need to!!! You already have that logic in your code"
😐😵☠ 🦍💊🔫🔪"you know what? I'm gonna give them a second look. Thanks"
And then I moonwalked out of the room -
When explaining unit testing:
"We tried but every time someone changes something in the database all the tests fail."
*facepalm*5 -
I really need to introduce unit tests.
Btw the module is meant for internal use and the readme is more for eventual collaborators than the general public -
I'm a strong believer in the triple-A unit-test pattern: Arrange, Act and Assert
Anyone else that uses this for their tests? Do you see any cons to using this approach to writing tests? Are you using an alternative?11 -
First thing Wednesday morning, fired up the macbook, opened vs code, ran the same unit tests that were passing last night, 1 failure! FML.
For some reason an Angular form that was valid with the same data last night isn't this morning. Probably some crappy date issue in the mock data1 -
When a senior programmer told you they're done implementing the feature but don't know how to write the unit tests1
-
Killing people is bad. But, there should be a law to allow killing people who don't write proper unit tests for their code. And also those "team leaders" who approve and merge code without unit tests.
Little backstory. Starts with a question.
What is the most critical part of a quoting tool (tool for resellers to set discounts and margins and create quotations)? The calculations, right?
If one formula is incorrect in one use case, people lose real money. This is the component which the user should be able to trust 100%. Right?
Okay. So this team was supposed to create a calculation engine to support all these calculations. The development was done, and the system was given to the QA team. For the last two months, the QA team finds bugs and assigns those to the development team and the development team fix those and assigns it back to the QA team. But then the QA team realizes that something else has been broken, a different calculation.
Upon investigation, today, I found out that the developers did not write a single unit test for the entire engine. There are at least 2000 different test cases involving the formulas and the QA team was doing all of that manually.
Now, Our continuous integration tool mandates coverage of 75%. What the developer did was to write a dummy test case, so that the entire code was covered.
I really really really really really think that developers should write unit tests, and proper unit tests, for each of the code lines (or, “logical blocks of code”) they write.20 -
I had an interesting mystery the other day. I work in the UK, but I'm working remotely from the US for a while. First day, I made some changes, ran the tests and they failed. Weird part was the failing test was for a component I hadn't touched. I took a closer look, and realized it was a date off by several hours. The test was checking that a passed in date appears in the output. But it was creating the date by parsing a string. The library I was using defaults to local time, but the component uses UTC. So, I had inadvertently created a unit test that only passes when run from UTC. But I had never noticed before because my work is in that timezone. Yikes!
-
TMW you want to introduce a big feature that will require you to refactor the existing code, but you don't have to worry about breaking the latter since you have tons of unit tests backing you up.2
-
Worst part about my job is training junior devs with their supervisor insisting them to write unit tests without prior programming experience2
-
When you write a new project using TDD and your colleague who isn't in to it make all unit tests practically fail and also breaks code style tests and doesn't give a flying monkeys.
His excuse is if you write tests what will test the tests -.-
What would your reaction be to that?2 -
My company never used unit tests. And i would love to educate but i do not know how to unit test properly. I always en up with: if i want to properly test all ins and outs of this class's + operator. I need to add checks for positive number, negative numbers, nan, infinites, nulls etc. Etc. It needs so many tests for something so stupidly simple, that i don't see a way to motivate people to use it.
Am i missing something? Is there a guideline for "ok coverage"? Is testing just that much work and is that why nobody cares until it is too late?
I have been reading a book about working with legacy code. But still i got no answers. Halp!7 -
I just wondered... Is it even possible to write unit tests for an OS kernel or a bootloader?
How would you do that?2 -
FUCK YOU JENKINS
The tests work everywhere just not for you
It worked before and I DID NOT CHANGE ANYTHING FOR THIS TEST TO FAIL
FUUUUUUUCK5 -
The monotony of begging management for budget to retrofit unit tests which should have been there in the first place is starting to piss me off.
-
Today started good, the latest PR merged in took our Flutter app to 66% coverage with 1009 tests.
This means we also have 1001 more tests than our companies other apps combined. 🤣 -
One of the founders of my startup does not write tests....
Me: we have to all write tests. I explain unit tests, integration, etc.
Him: I do... I have a test that checks if the app crashes or not.
Me: that is not what I meant (writes test because he won’t) 🙄1 -
Boss wanted our AES implemented to use an Initialization Vector. I changed the implementation to add an IV and all the tests passed on the first try!
I changed the implementation to fail just to make sure I wasn't getting false positives. -
Having to write a 3 page proposal to request "additional time" so you can write unit tests before and during development, explaining why it isn't a waste of time. 😩2
-
When you tell one of your teammates this would be a perfect feature to develop using TDD. They agree, and after a couple of days they send you a code review with 0 unit tests and a message saying "I will start working on the tests while you review this."
-
Remaining two days of current sprint : I offer to code unit tests to increase coverage, technical debt and stuff.
My colleague : I will start next sprint's feature.
:facepalm: :jealous:1 -
It's always great to work on software that hasn't been touched in over 3 years and see that all the unit tests for the app fail...
-
Swift being too new a language to have proper unit tests so you have to bodge something together to keep the client happy.1
-
Goals for 2018
- Add E2E test or unit tests to my projects
- learn a new (programming language) perhaps Go, or Rust
Better have a few than too many2 -
You know you're tired when you're setting up unit tests and you make more mistakes in setting up the tests than in the actual code.
-
Imagine living in fucking 2021 and still be writing unit tests. If genius can generate gravity, with those stupid people I bet antigravity exists lmao25
-
It usually starts with a project, a CI pipeline, unit tests, deployment guidelines, and wait - oh crap - what am I building again?
-
Write meaningful unit tests! Unit tests are like micro documentation for your code that you can validate in seconds.3
-
Now i am given a task to refactor some piece of Predicate code and then update the unit test so it can be compatible and work with new data
WHAT. Is the Fucking point of unit tests if you have to modify them to adapt to new code anyways???
Unit tests exist just so u can stroke ur sausage??? Just so u can give ur ego an orgasm to tell others "hey look at me how good code i wrote that even unit tests are passing!" ???
I always found unit tests sketchy. almost as if its useless and unnecessary. I still get why they are used (some other dev working on feature 2 might break my shit and unit test can save the day) but if thats the only reason then that doesnt seem like a strong enough reason for me
By now im talking about java!
No wonder i have never seen a single nextjs developer ever write a single unit test. Those people have evolved beyond unit testing just as the nextjs technology itself!
This is why nextjs is the future of web and the Big Daddy Dick King 👑 of technology!8 -
(Time to actually code feature + time to debug it + time for unit tests to pass/add) * 1.5
Works great in my case unless there are some big major road blocks -
Aiming for 90%, barely managing 60% ever.
From marks in school tests to code coverage in apps, the reality remains the same. -
Two real reasons people write unit tests:
- mommy’s boy can’t even fart without mommy’s approval, but instead of mommy, there are unit tests now
- Stockholm syndrome47 -
Gonna miss a deadline. Not sure if the fact that I'm insisting on writing unit tests, or the fact that I wrote only 4, is sadder.
-
Be humble. Nobody knows everything.
Keep learning: read books, take Pluralsight courses, go to meetups.
Write unit tests for your code. No really! Write unit tests for your code!
Learn what the SOLID principles are.
Your job does not define who you are, you define who you are.1 -
Need help in Unit Tests,
I've reached a point where tests randomly fail, but if I run that test alone it never failed.
I do have lots of shared data between test functions of the same test class.
What options do I have?
1. Make each function responsible of seeding data into InMemory database?
2. ??? (I don't know what else I can do)
Any help is great :)18 -
I'm overhearing two engineers agree that integration tests are enough and unit tests with mock data are unnecessary while the project has problems figuring out what components are critically misbehaving.
-
If I had a dev superpower, it'd be the ability to wave my hand to make integration tests and unit tests appear. Seriously, they're necessary, but also painful to write1
-
I'm an iOS developer and I cringe when I read job specs that require TDD or excessive unit testing. By excessive I mean demanding that unit tests need to written almost everywhere and using line coverage as a measure of success. I have many years of experience developing iOS apps in agencies and startups where I needed to be extremely time efficient while also keeping the code maintainable. And what I've learned is the importance of DRY, YAGNI and KISS over excessive unit testing. Sadly our industry has become obsessed with unit tests. I'm of the opinion that unit tests have their place, but integration and e2e tests have more value and should be prioritised, reserving unit tests for algorithmic code. Pushing for unit tests everywhere in my view is a ginormous waste of time that can't ever be repaid in quality, bug free code. Why? Because leads to making code testable through dependency injection and 'humble object' indirection layers, which increases the LoC and fragments code that would be easier to read over different classes. Add mocks, and together with the tests your LoC and complexity have tripled. 200% code size takes 200% the time to maintain. This time needs to be repaid - all this unit testing needs to save us 200% time in debugging or manual testing, which it doesn't unless you are an absolute rookie who writes the most terrible and buggy code imaginable, but if you're this terrible writing your production code, why should your tests be any better? It seems that especially big corporate shops love unit tests. Maybe they have enough money and resources to pay for all these hours wasted on unit tests. Maybe the developers can point their 10,000 unit tests when something goes wrong and say 'at least we tried'? Or maybe most developers don't know how to think and reason about their code before they type, and unit tests force them to do that?12
-
Fixed obvious bugs.
Tests started to fail.
All error messages read similarly—“Feature XXX contains an obvious bug blah blah blah. It’s supposed to fail, but it’s not.”
F____!!!!!2 -
I feel like most of the problems people are ranting about would never happen if they worked in a proper environment with lint checks, unit tests, e2e tests etc.
It's worth the effort to get it!4 -
What do you guys use to write unit tests in C? I look at some libs such as check, cmocka, gtest etc, but they all seem like way more than I need. Also, I have a hard time to separate test files and source code files (directory structure wise).
Any recommendations?5 -
When it turns out the 900 line unit test set up called another giant method which you need to dig through but it's labeled deprecated. O.o?4
-
Skipping jasmine tests- especially ones on partials (not the controller). Seriously, QA has automated test suites to test UI functionality. If it takes 30 mins to write the code and 3 hours to write the tests... it may just not be worth the effort when there already is automated testing.
Ugh I hate skipping them but you know how to test the UI? Use the UI. -
Microsoft Web Api:
"you can pick up on some of these implicit behaviours by reading the unit tests for the default model binder."
I don't know what I expected.1 -
After 30 minutes of fixing the code I finally noticed that someone switched the position of "actual" and "expected" when writing unit tests.
-
Do you guys take time to properly name your Unit tests ?
I kinda feel it's waste of time. (There are comments with description of the test tho)7 -
Creating unit test files, but being to lazy to write the actual tests and then giving up creating the files as well.
-
Unit tests pass locally but fail on the pipeline. After 3rd re-queue, pipeline tests pass. I am so over this bloody week.11
-
I really hate how steep the learning curve is for testing. I've been writing the same test for a week for a 150 line directive, and it's driving me fucking nuts. Nothing makes sense. No one in the office to help me. Only 10% of engineers here write any tests. I don't know what to do. Overnight they made it a rule that if you want to move up to the next level for software engineers, 80% of your code needs to have unit test coverage. It's just bullshit.3
-
Running unit tests on a peer review. Why have unit tests if people don't run them? That said: our system guy wants us to start doing agile TDD. This would not be a problem if we weren't a maintenance shop and the code base doesn't really allow for TDD.3
-
As a Vim evangelist, it's agonizing watching someone debug unit tests in RubyMine.
It physically pains me. -
My worst sin.....
I don't do unit tests...
In my head I think its a waste of time..
I test the program myself, it works, why should I write another program to test my program..?
Unit tests are good. They are all just excuses cos I'm lazy1 -
Is it slow ?
taliking about unit tests. I have 2746 unit tests in a project (Covering around 15% of code).
It takes around 2 minutes in local (With good PC) and aroubnd 20 minutes in a pipeline to execute.
Would you people say it's slow ?9 -
I want to run a theory by you regarding unit tests.
They make up for the time they cost to implement in the long run, no doubt, because when you're refactoring you can easily check whether you broke something.
But: what if you've got integration tests covering almost the entire codebase? For those to succeed the unit tests must succeed as well. So therefore imho the unit tests are redundant.
The only advantage of also having unit tests seems that they can pinpoint the issue more accurately.
Any other advantages? What am I missing? Any thoughts/comments?9 -
Why write unit tests? There is no benefit for the customer.
Me while trying to upgrade to an newer version... ┐(͠≖ ͜ʖ͠≖)┌11 -
Original class has 185 LoC, unit test class have 315.
But it's one of the most important classes, with most states and corner cases.
And, thanks to unit tests, one of the few classes I'm almost proud of. -
I'm currently developing a Node.js tool. Now I want to write some unit tests, but I never wrote unit tests for a node app before and I don't know which framework I should use. Do any of you have any experience with the available unit testing frameworks? In the past I only used Karma and Jasmine for Angular unit testing.2
-
Arrrrgh Fuck this shit. I thought debugging someone's code was fucked up. I was wrong, try debugging someone's unit tests.... Absolute nightmare
-
Is it actually required to write unit tests in microservices?
every time i write them it feels like im just redundantly copying a method...
Dont get me wrong, im not against testing, I am using test environments, integration tests and mocks, but unit test seem kinda redundant to me.5 -
Somethings I just want to throw my pc around the office because those f*cking unit tests that don't want to work😤🤬😡
-
Just spend two fucking days debugging a few methods in our program. I used unit tests to call those methods (don't want to navigate through the complete program workflow)...
Yeah, guess what: the test cleanup includes a fucking rollback transaction function. So NONE NADA ZERO FUCKING CHANGES WILL BE PERSISTED. Fuck me3 -
Tests, unit tests, integration tests, ui tests, tdd, bdd
I thought I was done with tests after school. Why, why you do this to me 😢😢😢4 -
Okay..
So, what do I have here?
A cross platform mobile app with NO unit tests.
😕
I have to write a big new feature from scratch. (Things can't go wrong, right?)
Started working on it, pointed out problems with the UI/UX designs. The design changed multiple times, still I thought I could finish it by the expected date. And, so I did.
The feature went through testing, and they found bugs. (Surprise...?)
It's already kinda scary to touch someone's code that has no unit tests and no comments. And I think, it's all the more difficult to not introduce bugs.
Also, had to work on the weekend to fix the bugs.
I had some good learnings here, but I'm not sure how I can prevent bugs without unit tests and proper feedback cycle. :/4 -
When you add a new method, two unit tests and the build breaks because you didn't use constants the way sonarqube wanted....4
-
I know unit tests and TDD get a bad wrap but I think they’re both great. The problem is people don’t think about what they’re actually coding.
Today I uncovered a unit test with 100 asserts in it.
And half of them are in a loop.
😳
If unit tests weren’t a thing then the dev who wrote this would still be a shit dev.4 -
Sometimes I deploy to production without actually testing the changes. At least I have my unit tests!
-
Preaching TDD/TFA without having gotten there quite yet. I have unit tests, but only half are actually TFA :(
-
Theo, the man who everyone looks up to as a dev, especially a nextjs dev, the man who created t3 stack--says he doesnt write unit tests and thinks unit testing is a waste of time
Have devs fallen into the new low?17 -
I really love JetBrains IDEs and I use them all day. However now the unit tests in the IDE are broken and cannot be run anymore. Please fix asap :( I can't work like this.2
-
Management wants me to write e2e tests instead of unit tests. The problem is there are e2e but not a single unit test... I plan on refusing.
-
Writing unit tests for singletons...
I would just want to refactor it so it’d be easier to unit test, but need to write unit tests in order to be allowed to refactor. Geez...3 -
Spent the day migrating to a different mocking framework for our unit tests.
Still a few hours of work to do until they'll all compile.
After that, who knows what'll still need fixing.
Pouring myself a tall one. -
When you change team, and you're trying to figure out why the system doesn't work as expected. Then you find out, someone disabled the unit tests.
-
"dont bother with unit tests we dont have budget for those" - still paying the price for naively following that one, every svn merge is a bastard now1
-
Had a 2 hour meeting where I was told to use Specflow for all of our unit and integration testing. It'll be easier for the business to read.
Spent 3 hours setting up the tests for the scenarios for the next story.
Had another 2 hour meeting where they decided it was a bad idea to wrap all unit and integration tests in gherkin...because the business users don't want to read gherkin... -
Writing Unit-tests for the first time and I'm starting with a C project.
That's a new kind of pain.1 -
Audience question to Uncle Bob: Which parts of the code do you unit test? What about code coverage?
Uncle Bob: Well (chuckling).. You test the parts of the code that you want to work. -
I dont see any advantage of TDD. I use integration tests and unit tests for very complicates modules.
Change my mind.5