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 testing"
-
One of my worst meetings, as the sheer rage was unbelievable.
Backstory:
Architect: "Stop duplicating code", "stop copy pasting code", "We need to reuse code more", "We need to look at a new pattern for unit tests" etc.
Meeting:
Architect: What did you want to talk about?
Me: I built a really simple lightweight library to solve a lot of our problems. Its built to make unit testing our code much easier, devs only need to change a small bit of how they work.
Architect: I like the pattern a lot, looks great ... but why a library? can we not just copy the code from project to project?
... do you have a twin or something?2 -
Testivus On Test Coverage
Early one morning, a programmer asked the great master:
“I am ready to write some unit tests. What code coverage should I aim for?”
The great master replied:
“Don’t worry about coverage, just write some good tests.”
The programmer smiled, bowed, and left.
...
Later that day, a second programmer asked the same question.
The great master pointed at a pot of boiling water and said:
“How many grains of rice should I put in that pot?”
The programmer, looking puzzled, replied:
“How can I possibly tell you? It depends on how many people you need to feed, how hungry they are, what other food you are serving, how much rice you have available, and so on.”
“Exactly,” said the great master.
The second programmer smiled, bowed, and left.
...
Toward the end of the day, a third programmer came and asked the same question about code coverage.
“Eighty percent and no less!” Replied the master in a stern voice, pounding his fist on the table.
The third programmer smiled, bowed, and left.
...
After this last reply, a young apprentice approached the great master:
“Great master, today I overheard you answer the same question about code coverage with three different answers. Why?”
The great master stood up from his chair:
“Come get some fresh tea with me and let’s talk about it.”
After they filled their cups with smoking hot green tea, the great master began to answer:
“The first programmer is new and just getting started with testing. Right now he has a lot of code and no tests. He has a long way to go; focusing on code coverage at this time would be depressing and quite useless. He’s better off just getting used to writing and running some tests. He can worry about coverage later.”
“The second programmer, on the other hand, is quite experience both at programming and testing. When I replied by asking her how many grains of rice I should put in a pot, I helped her realize that the amount of testing necessary depends on a number of factors, and she knows those factors better than I do – it’s her code after all. There is no single, simple, answer, and she’s smart enough to handle the truth and work with that.”
“I see,” said the young apprentice, “but if there is no single simple answer, then why did you answer the third programmer ‘Eighty percent and no less’?”
The great master laughed so hard and loud that his belly, evidence that he drank more than just green tea, flopped up and down.
“The third programmer wants only simple answers – even when there are no simple answers … and then does not follow them anyway.”
The young apprentice and the grizzled great master finished drinking their tea in contemplative silence.
Found on stack overflow https://stackoverflow.com/questions...8 -
Came home late last night and told my wife I'm skipping dinner to take a 1hr nap as it's going to be a long night of bug fixing and testing. Woke up, my wife and 1yr old son are already asleep. Saw the pic below posted on the wall above my work area at home. She's a teacher, she's never heard me mention it, and I don't use this method (I prefer music on my headphones). But she does know I lurk devrant so she must've browsed here while I was napping. Feels good. Code fixed, checked-in, unit tested and released for user testing.6
-
Been lurking here for a while. Finally pissed off enough to post.
Been programming in Ada for nearly a decade now. One of the few younger devs who knows the language well. Have a large collection of libraries and tools written in it, open source. Done contract work. Looking to get out of my current line of work, which is medicine, because fuck this recent legal climate. I'm spending all my time dealing with legal compliance and it rapidly changing.
I see a job posting from a company looking for a programmer to mostly write testing stuff for clients. They mostly work with Ada. I've written a whole unit testing and integration testing framework. Perfect. Apply. "You don't have the required skills." Oh... K then.
Wanna guess what I was just offered as contract work. Same company. I guess i'm fucking qualified if you asswipes sought me out to ask me to fix your fucking bullshit.
What the hell is wrong with management and HR in recent years?9 -
The moment I dared ask a colleague about unit testing, and instead of giving me a book or a look, he stashed his work, pulled over a second chair and we coded some, for an hour.3
-
Not so much screaming as staring in disbelief, mumbling profanity in his direction...
When my department lead said "I don't think this unit testing hype or code reviews make much sense, it's more efficient to just make a checklist and test the application yourself"
This was the QA department of an aerospace company, we wrote NDT software to do image recognition on xrays of alloy welds and micrometer laser measurements on fuel tank surfaces. Software which is quite mission critical, a single misrecognized welding fault could literally cost up to half a billion dollars — not to mention that it's a very sabotage & espionage sensitive industry.
After raising some hell he was replaced though.3 -
Imagine if a structural engineer whose bridge has collapsed and killed several people calls it a feature.
Imagine if that structural engineer made a mistake in the tensile strength of this or that type of bolt and shoved it under the rug as "won't fix".
Imagine that it's you who's relying on that bridge to commute every day. Would you use it, knowing that its QA might not have been very rigorous and could fail at any point in time?
Seriously, you developers have all kinds of fancy stuff like Continuous Integration, Agile development, pipelines, unit testing and some more buzzwords. So why is it that the bridges don't collapse, yet new critical security vulnerabilities caused by bad design, unfixed bugs etc appear every day?
Your actions have consequences. Maybe not for yourself but likely it will have on someone else who's relying on your software. And good QA instead of that whole stupid "move fast and break things" is imperative.
Software developers call themselves the same engineers as the structural engineer and the electrical engineer whose mistakes can kill people. I can't help but be utterly disappointed with the status quo in software development. Don't you carry the title of the engineer with pride? The pride that comes from the responsibility that your application creates?
I wish I'd taken the blue pill. I didn't want to know that software "engineering" was this bad, this insanity-inducing.
But more than anything, it surprises me that the world that relies so much on software hasn't collapsed in some incredible way yet, despite the quality of what's driving it.44 -
THIS is why unit testing is important, I often see newbs scour at the idea of debugging or testing:
My high school cs project, i made a 2d game in c++. A generic top down tank game. Being my FIRST project and knowing nothing about debugging or testing and just straight up kept at it for 3 months. Used everything c++ and OOP had to offer, thinking "It works now, sure will work later"
Fast forward evaluation day i had over 5k lines of code here, and not a day of testing; ALL the bugs thought to themselves- "YOU KNOW WHAT LETS GUT THIS KID "
Now I did see some minor infractions several times but nothing too serious to make me refactor my code. But here goes
I started my game on a different system, with a low end processor about 1/4 the power of mine( fair assumption). The game crashed in loading screen. Okay lets do that again. Finally starts and tanks are going off screen, dead tanks are not being de-spawned and ended up crashing game again. Wow okay again! Backround image didn't load, can only see black background. Again! Crashed when i used a special ability. Went on for some time and i gave up.
Prof saw the pain, he'd probably seen dis shit a million times, saw all the hard work and i got a good grade anyways. But god that was embarrassing, entire class saw that and I cringe at the thought of it.
I never looked at testing the same way again.6 -
Worst bad practice..
Manager: I need code today
Developer (thinking) : let me give it without unit test. Anyways tester will test it.
Manager to tester: complete testing fast.
Tester(thinking): developer must have unit tested it. Let me skip it.
Enjoy testing completed.
God help clients.. 😊5 -
"Trinidad And Tobago" changed their country name to "Trinidad & Tobago", and the .Net framework reflected that change.
So that's why this unit test is failing.
I GUESS BULLSHIT IS NOW INTERNATIONAL.2 -
How can testing and debugging 10000 lines of uncommented, obfuscated code get worse?
Testing and debugging 10000 lines of uncommented, obfuscated code in visual studio.5 -
OH MY FUCKING GOD! WHY THE FUCK WOULD YOU REWRITE A FUCKING PIECE OF CODE AND DON'T MAINTAIN ITS FUNCTIONALITY?
ARE YOU FUCKING MAD????
JUST SPENT 1 FUCKING HOUR TRYING TO FIGURE OUT WHY THE FUCK THE DATA WASN'T BEING PASSED TO REDUX STORE!
YEAH, UNIT TESTING SURE IS A FUCKING WASTE OF TIME YOU DUMB FUCKING IDIOT THAT HAS MASHED POTATOES FOR A BRAIN!
GO ROT IN HELL YOU PIECE OF SHIT!!!!
NOW IF I DON'T FIX THIS SHIT MY ASS IS ON THE LINE BECAUSE I MADE THE FUCKING FUNCTIONALITY THAT YOU BROKE?? NO FUCKING WAY!
I DON'T CARE IF YOU ARE MY BOSS, I'M GONNA GIT BLAME THE SHIT OUT OF YOU IF ANYONE PISSES ME OFF!1 -
As a Java developer, reasons to kill other programmers:
- static mutable variables
- WRITING to static mutable variables
- API call with Framework X didn't work. Add Framework Y along with X and try that. Wrap X in try/catch statement. Catch block fires framework Y.
- six, seven, ten levels of nested code. Zero thought put in organization
- 6K LOC Java files
- spring (singleton? Maybe) object assigning values in static mutable (see pt.1)
- a couple of unit tests in code base that no longer work. Zero unit tests in new code
- unit testing disabled in CI pipeline
- empty catch blocks
- pass mutable data between threads. Modify in various places concurrently.3 -
No boss... For the fucking millionth time: unit tests are not a waste of time.
You keep testing everything manually and hoping that you tested everything every time and praying that there are no bugs IS THE FUCKING TIME WASTE
My boss just can't fucking wrap his head around automated tests... I'm trying hard... Gonna try harder...6 -
My devGoals for 2018:
- Build a RESTful API with NodeJS just for learning.
- Finish my first product (electronics sideproject).
- Convert more people to use CraftCMS or at least not use Joomla or WP.
- Get a raise.
- Add Continuous Integration to more projects.
- Add more unit testing where appropriate.
- Create and release a mobile app.
To be continued...
*playing to be continued meme sound*9 -
My friend and boss,told me he would teach me code 2 years in a half ago.
I didnt know what css or html was and i used to call java javascript.
I can know create my own module with webpack, have my automated doc, use react, redux, he taught me linux, git,unit testing, databases,docker, and so on...
Im not an expert in any of it butbi know what they are for and can play with them more or less comfortably.
The best advice he ever gave me was:
“coding is not about coding. We are like the greath painters of history. They were great at painting but even more at creating. If you have no creativity, you can paint as well as you want, its worthless.”2 -
I am fed up working with unskilled software developers. Or to be more specific, working with people who have no idea of sofware architecture.
Most people I've worked with have simply no idea what they are doing in the broad picture, they can only follow patterns they see and implement their feature in the same way. They can't think about the abstract concepts which should be the foundation of the project.
They fail to write unit tests which are maintainable. They write one fucking test per method which is testing 50 things at the same time, making it often impossible to understand what is being tested.
They think putting stuff in private methods makes their class better and is some kind of separation of concerns.
They write classes and afterwards create interfaces for these classes named {Class}Interface, shoving all the methods into that interface. They think it's good design to do so.
They are unable to think about the reasons why things are done the way they are done and that you don't do stuff for the sake of doing stuff, but to achieve certain goals like interchangeability.
They don't undestand how to separate business logic from the application code.
They have no sense for naming things beautifully. They don't see how naming things is a major part of good software architecture.
They get layer concepts wrong and then create godlike {EntityName}Service classes, which do everything related to a particular entity.
They fail to shape the boundaries within a software project, entangling stuff which should live in individual modules.
All I want is to work in a team with professionals.2 -
I joined a "multi-national" company in middle-east where 90% of the developers are Indian. And since it's a "multi-national" company with 50+ developers I thought they already figured it out. Most of them have 5-10 years of experience. They should know at least how to use git properly, deployment should be done via CI/CD. database changes should be run via migration script. Agile methodology, Code Review - Pull Request. Unit testing. Design Patterns, Clean Code Principle. etc etc
I thought I'm gonna learn new things here. I have never been so wrong in all my life...
Technical Manager doesn't even know what Pull Request is. They started developing the software 4 years ago but used Yii v1 instead which was released almost a decade ago. They combined it with a VueJS where in some files contains around 4000 lines of code. Some PHP functions contain 500+ of code. No proper indentions as well. The web console is bloody red with javascript errors. In short, it's the worst code I've seen so far.
No wonder why they keep receiving complaints from their 30+ clients.10 -
I don't understand unit testing, you won't explain it to me and I will never use it properly.
Go fuck yourself, internet of modules and node.js and fucktards who think they write good code but suddenly my simple webapp is 200mb big without even adding any content yet.16 -
User: “I’ve tried hundreds of different names. How come all the usernames are registered?!😤”
Developer: ”I’m quite confident about my code. Can’t find any issue in this login form.🤔”
QA: “It passed all unit tests. We did a comprehensive testing on live server by registering all the possible names. What can go wrong?🙀”1 -
Today I'm going to work on my side project that I haven't touched in weeks.
I want to utilize Angular 2 which means I'll need to learn TypeScript. I also want to use the new .Net Core and EF Core 1.0. Oh and I want to handle authentication using JWT!
Wow, that's gonna be a lot of effort to get things off the ground... maybe instead I'll use this time to learn some new concepts. Maybe watch this episode of Fun Fun Function, or maybe this video on writing Assembly code for an app on Raspberry Pi, that sounds cool!
Actually, you know I should really teach myself dependency injection and unit testing for once. I'm so behind the times.
Well, really I should finish this book on design patterns first. Ok, where did I leave off? Page 20 I think... ehh... maybe I'll just work on my side project.
Tomorrow... tomorrow, I'll work on my side project.9 -
I hate people who think that building software is all about one click away and generating things. I got told to complete the task faster than the speed of light.
Fancy me some rant time? Let's name that cunt, "Bob".
"
Hey Bob, I got questions for you. Are you sure you were in your mum's womb for 8-9 months? Are you the kind of twat who honk at people as soon as the traffic light's turning green?
Building software takes time, the CI/CD takes time, TestFlight takes time, approvals from the Google Play store take time, approvals from Apple App Store connect take time, Unit testing takes time and every fucking thing you can name takes time!
It's just like sex, nobody wants to be with someone who can only last in bed for 0.000000000001 nanoseconds, the longer, the better, (but not too long).
It is also like building houses, which takes months to build not hours. As from my experience so far, something tells me that you are not the kind of person who would understand how to build a house but a sand castle which takes only hours to build.
Relentlessly, you bombarded me with a pile of bollocks and a pile of nonsense is not going to fasten up the compilation of the software.
"4 -
1. Slack. Pretty good chat app for dev companies, I use it to prevent people standing next to my desk 40 times a day.
2. Unit testing tools, especially when fully automated using a git master branch hook, something like codeship/jenkins, and a deployment service.
3. Jetbrains IDEs. I love Vim, but Jetbrains makes theming, autocompleting & code style checks with mixed templating languages a breeze.
4. Urxvt terminal. It's a bit of work at the start, but so extremely fast and customizable.
5. Cinnamon or i3. Not really dev tools, but both make it easy to organize many windows.
6. A smart production bug logger. I tend to use Bugsnag, Rollbar or Sentry.
7. A good coffee machine. Preferably some high pressure espresso maker which costs more than the CEO's car, using organic fairtrade hipster beans with a picture of a laughing south american farmer. And don't you dare fuck it up with sugar.
8. Some high quality bars of chocolate. Not to consume yourself, but to offer to coworkers while they wait for you to fix a broken deploy. The importance of office politics is not to be underestimated.1 -
Reject original specs. Do the bare minimum MVP that works and solves problems people actually have, and not problems you think people have.
Improve it if needed.
In my experience, software projects don’t live long enough to outgrow the MVP. If they do, it happens way down the road. At that point, business will change, and the original spec will become irrelevant.
It’s a paradox: 90% of the spec was discarded, but the business is happier than if we followed the spec word by word.
Also, static typing and unit testing solve nothing. I’m sorry.24 -
Old boss story. This guy was nice but a terrible boss. Also relevant, he has a background in IT so should know better.
Him: So when you wanna check a password is correct you just unhash it in the database?
Me: *facepalm*
Me: Hey we should be doing unit and integration testing at a minimum to lower bugs.
Him: We don't need those, we're not a bank. If a problem comes up we just fix it and push to production.
(A while later)
Him(in email): Why do we keep getting bugs reported. Don't you devs test your code.
I was mildly annoyed at that one.
Him: We're always over budget on projects, how can we fix this.
Me: What if we increase our quotes.(technically there are other ways as well but not really possible at that time)
Him: We can't do that, clients won't want to pay.
Me: *finishing off my handover as I'm leaving for a new job*
Him: Wow you do a lot of work2 -
There's so many cool technologies too look into now a days, but so little time.
-docker
-laravel
-.net
-react
-es6/es7
-elasticsearch
-redis
-unit testing
Where do i download more hours to add to my days?16 -
Well now, I wouldn't want to mention anyone specific since talking about someone behind their back and calling them 'weird' isn't very nice. 🙄 But absolutely HYPOTHETICALLY speaking, if I HAD a weird coworker, they would probably...
- ... strut about the office, telling all how great yet underpaid their work is
- ... write lots of 'concepts' because coding is for lowly programmers
- ... insist that the code they have to do when boss is looking is simply too complicated for unit testing, and 'that's great!'
- ... brag about their/wear to work a ridiculous array of ties in every colour imaginable, when everyone else shows up casual
- ... trap people into listening to them talk for hours about...
-- ... ties
-- ... their misspent youth
-- ... how awesome they are/were/will be
-- ... why it's a good idea to eat cheese
- ... never let me forget I'm female, coz *insert BS reasons why all devs must by nature be male here*
- ... send me little unsolicited notes and mails with funny (sexist) jokes *har har*
- ... be let go, at which point everyone else discovers why they had so much time that they could spend chatting away at the watering hole
- ... earn the eternal hatred of anyone picking up the pieces of their 'work'
- ... try to steal our customers away who will laugh in their bloody face
Just my theory, of course..3 -
Dynamically typed languages are barbaric to me.
It's pretty much universally understood that programmers program with types in mind (if you have a method that takes a name, it's a string. You don't want a name that's an integer).
Even it you don't like the verbosity of type annotations, that's fine. It adds maybe seconds of time to type, which is neglible in my opinion, but it's a discussion to be had.
If that's the case, use Crystal. It's statically typed, and no type annotations are required (it looks nearly identical to Ruby).
So many errors are fixed by static typing and compilers. I know a person who migrated most of the Python std library to Haskell and found typing errors in it. *In their standard library*. If the developers of Python can't be trusted to avoid simple typing errors with all their unit tests, how can anyone?
Plus, even if unit testing universally guarded against typing errors, why would you prefer that? It takes far less time to add a type annotation (and even less time to write nothing in Crystal), and you get the benefit of knowing types at compile time.
I've had some super weird type experiences in Ruby. You can mock out the return of the type check to be what you want. I've been unit testing in Ruby before, tried mocking a method on a type, didn't work as I expected. Checked the type, it lines up.
Turns out, nested away in some obscure place was a factory that was generating types and masking them as different types because we figured "since it responds to all the same methods, it's practically the same type right?", but not in the unit test. Took 45 minutes on my time when it could've taken ~0 seconds in a statically typed language.11 -
Just tech screened a kid for a senior Network automation role, in a specific niche.
He's never automated anything before. Didn't know networking basics, didn't know about the niche...
This guy hasn't heard of unit testing or UDP... good luck out there kid. You've got balls anyway.14 -
"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 -
The weird feeling you get when you ask a colleague what he recommends as unit testing framework for C# and his first response is: "What do you mean by 'unit testing'?"11
-
After 10 years of development, and 7 years of being happily married, I'm in love again... With Unit Testing.
-
Today, implemented Binary Tree from scratch and then wrote a unit testing suite from scratch in my personal project.
Pretty neat.7 -
"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 -
Skipping unit tests and documentation ...
I'm starting to recover after not writing a single test for the first 6 years of my professional carrer (wasn't taught in school, didn't know where to start, man I should have really found a mentor earlier), and barely any documentation (I was the sole developer for several years, and just didn't get into the habbit).
Unit testing is still not a habit, but now I have the first tests to serve as an example and an idea what/how to test at least, and I try to get every new "framework" function/class at least commented properly.
Wish me luck2 -
Boss left. Now I'm the only c# developer left to maintain 137 projects at this company. I woke up to a flood of emails with 3 requests and 2 applications breaking because he was a shitty programmer and didn't understand layering and design patterns and unit testing. Fucking dear God help.10
-
Ignorant, stale old Dev I work with discovers huge bugs with a new project. A few weeks earlier I had brought up the fact that he does zero unit and behaviour testing and got basically laughed at.......
-
Working in the embedded systems industry for most of my life, I can tell you methodical testing by the software engineers is significantly lacking. Compared to the higher level language development with unit tests and etc, something i think the higher level abstracted industry actually hit out the of park successfully.
The culture around unit testing and testing in general is far superior in java and the rest.
Down here in embedded all too often I hear “well it worked on my setup... it worked at my desk”.. or Oh I forgot to test that part.. or I didn’t think that perticular value could get passed in... etc I’ve heard it all. Then I’ve also heard, you can’t do TTD or unit tests like high level on embedded... HORSESHIT!
You most definitely can! This book is a great book to prove a point or use as confirmation you are doing things correctly. My history with this book was I gonna as doing my own technique of unit testing based on my experience in the high level. Was it perfect no but I caught much more than if I hadn’t done the testing. THEN I found this book, and was like ohh cool I’m glad I’m on the right thought process because essentially what they were doing in the book is what I was doing just slightly less structured and missing a few things.
I’ve seen coworkers immediately think it’s impossible to utilize host testing .. wrong.
Come to find out most the of problems actually are related to lack of abstraction or for thought out into software system design by many lone wolf embedded developers.. either being alone, or not having to think about repercussions of writing direct register writes in application or creating 1500 line “main functions” because their perception is “main = application”. (Not everyone is like this) but it seems to be related to the EEs writing code ( they don’t know wha the CS knows) and CS writing over abstraction and won’t fit on Embedded... then you have CEs that either get both sides or don’t.. the ones to understand the low level need but also get high level concepts and pariadigms and adapt them to low level requirements BOOM those are the special folks.
ANYway..the book is great because it’s a great beginner book for those embedded folks who don’t understand what TDD is or Unit testing and think they can’t do it because they are embedded. So all they do is AdHoc testing on the fly no recording results no concluding data very quick spot check and done....
If your embedded software engineers say they can’t unit test or do TDD or anything other than AdHoc Testing...Throw the book at them and say you want the unit test results report by next week Friday and walk away.
Lol7 -
Today I started work on a new project that contains a lot of legacy. I asked the developers about unit testing javascript and was told that not only is there none in place, but it's not worth adding any in.
At first, I grimaced and thought fair enough. This is their codebase, it's their choice. I've now been thinking about this for a few hours and have instead decided that screw those guys, I'm adding in a testing framework, a module pattern that's compatible with the existing code, and unit testing the crap out of it. If they don't want it they can refactoring it out, but I can't bring myself to intentionally deliver code I know is crap.
I WILL FORCE CODE QUALITY ON THEM.7 -
Greatest dev sin.... oh god there’s been a few over the years.
Hmm 🤔
I guess one of the top 5 would be making an ecommerce platform without unit testing or documentation for the front or backend. 🤫
Mind you it runs smoothly to this day so I was doing something right 😦1 -
Most unrealistic deadline I've had?
The client gives us a project with A 3-month deadline. All good, at first.
3 days later they told us that they're cutting out the funding and they gave us two options: Either stop the project right away and get paid for the work so far, or somehow finish the project in 7 days and get paid for the 10 days worth of work.
My idiot boss chose the second.
Saturdays and Sundays were declared working days, everyone screaming at each other, devs running around scrambling code to make the webpage render and keep it responsive.
Forget unit or automation testing, we only did not null and undefined testing and submitted the project.
Yeah, I hauled my ass out of the company just after that.4 -
I shit you not. This this a job qualifications qualifications entry level on LinkedIn.
7+ years working as part of a development team and with the following technologies:
Node.js Typescript and Java-based, microservice-driven applications using Spring Boot or similar framework
RESTful API design / microservice architectures
MongoDB or any other NoSQL DB
Message queues e.g. RabbitMQ, Kafka etc.
Modern MV*(MVC, MVVM, etc..) frameworks e.g. React, Angular, Vue etc.
JavaScript and design patterns, CSS and HTML
Modern CSS and view libraries e.g. RxJS, Angular Material, Typescript, JS ES6 etc.
Unit and UI testing using third party tools e.g. Jest, Cucumber, Groovy & Spock, etc.
Bachelor's degree in computer science or related field6 -
Some ranters get pissed with junior dev who thinks unit testing is not necessary and a waste of time. While I'm here convincing all senior devs in my office why testing is important. I gave up.3
-
Found out today that the company wants to hire the consultant that thinks that unit testing is a waste of time, CI and code coverage metrics are useless, DI is mumbo-jumbo. But 500+ line procedural methods are fine, you just start the method with a small essay of a comment on what it does...6
-
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
-
Today I had to write a unit test to test a method that internally used a random number generator...
Aha
Ahaha
Ahahaha
My test was literally just assertNotNull...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 -
git push origin stupid-long-feature-name
git pull origin develop
*Checks through all changes. No major conflicts. Accepts changes.*
npm test
*4 failing tests, none of them in pieces that I touched for my feature.*
*That's funny. QA was loaded from the develop branch, and everything works.*
*Actual data has dates from today. Expected data has dates from a week ago.*
*examines tests*
Why are all these expected dates hard-coded‽
tl;dr The external development team committed 4 tests that would only ever pass on the day they were written.5 -
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 -
After working 3 years in my current job and my boss hating anything to do with unit testing etc, I used my spare time to refactor our Makefiles to allow for the creation of unit and integration tests. I technically didn't tell my boss about it, so my heart was in my throat when he Skyped me with 'what did you change in ...'?
After having bashed any workflow with testing in it, I showed him the new workflow and automatic testing in Jenkins and he was actually enthousiastic, just like all other employees! I was hailed a hero in the R&D department, after all this time we can finally write universal tests. :D7 -
The fucker complains when someone doesn't write unit tests, meanwhile he tops any new code he writes with a @codeCoverageIgnore annotation ... 😒😒7
-
I don't get it why there are so many people out, that think testing stupid model classes with getters and setter is needed.
Dude. There is no logic in this class ... it's pure data that gets not modified there (well except if you call the setter)
I've wasted way too much time writting useless unit test because some ppl want to masturbate on 100% code coverage 🤦🏻♂️12 -
Question time:
Has anyone used PHP unit with Selenium before?
I have a.. well words can’t explain it nice enough but, beyond a joke, not even funny, spaghetti code base I’ve come to inherit recently, which god help me, doesn’t follow any design patterns at all, it’s just a stamp this here, staple this down over here and throw paint at the wall and hope it sticks.
It’s a mixture of procedural and functional with the rare class kind of mess.
So attempting to refactor by any means is not a real possibility without some kind of behavioural testing in place first otherwise I know I’m going to end up breaking something somewhere and not even know it.
Also if anyone has had the privilege of such code bases, tips to dealing with the mess are appreciated.
Oh and no, I can’t rm -rf or start again.😭3 -
Fucking first rant here:
So we tried to teach Two new colleagues to typescript and git and testing and stuff and we have a SPOC “which claimed to be very technical”. The SPOC’s task is to keep an eye on the work, and today we have had a review...
After two weeks, the created multiple branches into our git, all with one commit of 400 LOC changed, no merge requestet, issue in Redmine set to “closed”.
Well, by the way they were supposed to write Unit tests for our app.
But I thought, ok, we’ll check their branches.
Their tests all passed (cz) but man, the app didn’t and on compilation there were errors, the app is broken. Damn.
Is it really so far off, that even of They wrote tests, that the app should still work?
AND I THOUGHT IT IS COMMON SENSE. Damn!
Guess how needs to fix it6 -
"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 -
Apart from having a baby which is the hardest in the world,i think the hardest project is to learn to code.
I studied philosophy and anthropology but gamed a lot. Me and a good mate decided to work together and he told me hed teach me coding.
The guy is a genius but he is a reckless rebel genius who tells everybody to fuck off.
So,after 1 year in a half of intense coding where i had to learn linux, networks, and im not shitting you html and css as well and of course javascript.
He has now put me on, for the last 2 month, in charge of our front end backoffice. I have to design forms that do the right http requests,do the unit testing, play with redux-form, react-redux and he has thrown me into the basic java backend so i can begin working with entites and how i serve the data and link it to the database and even create tables.
Every time i fail hemakes me remake everything.
I actually came on devrant to study the dev community (i always gamed a lot but this is a whole different community). The dev community is pretty awesome and unique.
Anyhow, i remember when i saw him as me to complete an exercise and i didnt event know which words were the reserved language ones and those i could use myself. It was like fucking magic.3 -
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 -
I just want to share this:
When I start working at my last job, I have little idea of what a unit test was.
My boss on one meeting said that unit testing will be mandatory (wich is ok and umderstandable).
Almost a *year* after that, no one still care about them. I see myself doing them the best I can, but I saw things like wrap the assertion line with "try / catch" to lie to the coverage and unit test percentage. Or in other cases directly uploading *manually* the code on the server without test at all.
And then, as the only developer who do the unit test ok I have to do the missing ones and repair the fake ones.
Then when something explodes the question all the managers love to ask "Did we had the testing?"
At least I quit... that job was some crazy shit, this is just one story of many.
Like that other time that my co-workers did not understand why I needed to do POJOs on an android app because the big bad JSON that the app used was working fine.... -
Dear coworker,
when I asked: "So, how does it work?", I didn't expect the answer to be: "Well, you push this button, wait three seconds and when it's finished, this LED turns on."
I was hoping for a more in-depth description (like, the way you'd consider me to be seriously interested in your work or learning from you) along the lines of "Well, you see, I have written this CLI-Tool here, which connects to the adapter and parses the contents of the file via serial interface to the on-board controller. This controller performs an integrity check of the device and then decides whether to flash or not. The testing unit itself checks if its being programmed with the right parameters."
Of course I know how a programming device works but I was interested in your solution in this special case ... so I think I'll just check the doc later if there'll ever be some.4 -
Writing a Unit test to test the Unit test that's testing your application, because you can never be sure about anything.6
-
When your product owner tells you to forget about architecture and unit testing, "just push it out"...2
-
We have a production release tomorrow and we didn't have any kind of testing other than the unit tests we wrote. 💣💥🤯🎆3
-
Does anyone get the feeling that as they become more senior, they care less about meeting "best practices" and more of just "good enough"?
Best practices being everything in those books about TDD, unit testing, design patterns, design artifacts.
Good enough: enough so it won't blow up in prod, some tests but not 80-90%, some docs. Basically not like those public docs, open source projects/frameworks where function is covered
When I first started professionally, I was all about efficiency, good design, reducing technical debt, clean code.
But now, I look at problems and instinctively I may make these decisions but I don't really think about it much. First goal is to just get something working, clean it up later... Maybe.6 -
I'm finally writing unit tests consistently thanks to a simple file organization decision.
I'm not doing pure TDD, but at least I'm writing the tests immediately after writing a module, and I make sure they run ok.
What I'm doing is Instead of putting the test files in a "tests" dir at the root of the project, I have the tests right next to the source code.
So if I have a dog.x file, I also have a dog.test.x file next to it.
I'm not inventing gunpowder here. I've seen several people do this.
But it's something that is not generally made a default or advised to do.
Like I said; test frameworks in general go with the classic "tests" dir.
But for me this is day and night in whether I write the tests or not.
Which makes sense. Imagine the classic scenario of the "tests" dir, and you just created a file deep into a hierarchy, let's say src/lib/console/windows/dog.x
This means that if you want to write tests for that, you need to make sure the hierarchy tests/lib/console/windows/dog.test.x exists
If the test file already exists, but you want to access both files, you need to traverse deep for each.
Also, it's actually harder to keep track which files have unit tests and which do not.
Meanwhile, if the test files are next to the source, all these problems disappear.
That doesn't mean there are no other challenges with testing, like testing untestable things, like system calls or http requests, but there are ways to deal with that. -
now I’m starting to understand why unit testing is helpful as I’m making more and more features to the existing system I’m beginning to realize that the more shit I add the more chances I have of the existing components to fucking break for no reason this is very annoying and time-consuming11
-
Management has been promising we'd leave .NET framework for 2 years now. Never fucking happens. A new ASP.NET project was just started last week and yup, OF COURSE, its .NET Framework 4.8.
I'd even be happy with one of the earlier .NET Core versions at this point for fucks sake. I have no clue why tech leads are so happy to create a brand new project on a deprecated framework version.
And yes, I have checked thoroughly. Our whole infrastructure works with .NET Core onward. People are just too lazy to learn new stuff.
Stuff like switching to .NET 6, actually doing unit testing, improving our CI/CD pipeline, refactoring problematic codebases, etc. -> all this stuff is the kind of things they promise me I can work on later whenever I'm so bogged down with work that I'm looking for a light at the end of the tunnel. All empty promises.
Ideally we should be on .NET 6 since its LTS and just stay on the LTS versions as the year goes on.8 -
There is always that one guy.. who doesn't give a fuck about testing and thinks he's not responsible for them...
Le Guy: lemme just push ma new code maan
Jenkins: Unit Tests failed - pls fix
Le Guy to the one who cares about testing: hey fuck uu, ur stupid tests are failing... fix them its ur problem.
*sigh*7 -
Need to rant. I am doing programming 2 at university with java and the assessment is to make a card game. The subject is shit and is basically going over loops, variables, conditionals ect which we learned in introduction to programming and programming 1.
This leaves little time for oop principles, design patterns inherentance and all other useful stuff.
I am dedicated to making a career in programming and want to do my assessment the correct oop way. Although the lecturer doesn't care and is instructing the class to do it procedurally and shit.
I could do the program really quickly the shit procedural way and still get full marks but I feel dirty as hell coding like a scrub. So I'm 60 hours in on this assessment and there are so many classes and even more because of unit testing (we don't have to unit test) and I am spending way too much time.
My code is beautiful, my classes are tiny and maintainable, easy to modify and I'm learning so much about how to code oop the correct way with the help of a mentor and someone I look up to. But god does it take forever to code this way. And soo many iterations and redesigns because I'm still learning.
It's almost done but now I have another programming assessment for another class I'll have to do the dirty way because of time restraints and other assessments.
Sorry for wall of text but this is stressing me out 😛4 -
Our best dev/arch just quit.
C dev lead & a dev staying late chatting.
Lead: am building, takes long
Dev: unit testing, time taking
Ask them y they r building on their latitudes when we got them linux precision with xeons/64gb workstation 1 each ?
Both: I code on latitude.
Build/test times. (pure Java/maven)
Latitudes=an hr or more
Precision=2m to 11m
Jenkins Infra we have =10 mins with test & push. Parallel builds support.
Am suposed to help with an open mind. They now want Mac pro12 -
My new favourite commit message:
"All changes as of 18th Sept"
How tremendously useful? There I was looking to know what changes were made to enable a feature / service, thought I could look for that in the commit message, but no you've given me a much more efficient way of finding out.
I simply need to download the contents of your memory, find out what date you made a change, and then dig through the massive commit to find the piece of info I need.
Forget experience using Git features, managing merges, following Git flow, or even any other SCM ... how can people be so tick when it comes to recording what they've done.
Heres a little cheat sheet for those struggling:
- Commit message
Describe what you actually ****ing did. Don't tell me the date or the time, thankfully Git records those. Don't tell me the day of the week, if I need to know I can figure that out, just tell me what ... you ... did.
- Feature branch names
Now this is a tricky one. You might be surprised to know that this isn't in fact suppose to be whatever random adjective or noun popped into your head ... I know, I too was shocked. The purpose of this is to let other people know what new feature is being worked on in this branch.
- Reusing feature branches
Now I know you started it to add some unit tests, and naming it "testing" is sort of ok. But its actually not ok to name it testing when you add 3 unit tests ... then rip out and replace 60% of the business logic. Perhaps it would have been wiser to create a new feature branch, given you are now working on a new feature.2 -
Holy crap, I can't take it anymore.
I know that user acceptance testing is supposed to be done by the end user but it's as if they entirely skipped UNIT TESTING and QUALITY ENGINEERING.
Does their API work? Yes. It does.
Are their endpoints working? Sort of... why are query parameters required again?
Is it good overall? No, there are CORNER CASES ALL OVER THE PLACE (are they even still corner cases at this point?). It feels like it was made by amateurs!
Why am I doing quality testing on their services??? holy crap, they should pay ME for doing this1 -
Lead: how long do you think it would take to fix the bug?
Programmer: 20 mins with a testing
**Lead an hour later**
Lead: I don't see PR for the fix
Programmer: the fix broke all the unit tests so I am fixing them now. -
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 -
Unit testing is cool and all, but FFS...
If you want unit test - cool. But its not drop-in replacement for functional testing!
I believe each release should be manually tested.9 -
Listened for about a half-hour yesterday to DevA ‘beat down’ DevB writing a console app for trying out a proof-of-concept idea he had.
DevB: “What’s the URL of the development server?”
DevA: “Why? What are you doing?”
DevB: “I’m needing to throw some messages to it so I can capture data for something I’m working on.”
DevA: “How are you calling the service?”
DevB: “I wrote a console app”
- you could almost hear the eye roll -
DevA: “A console app? Why in the world would you write a console app?”
DevB: “Oh..um..no reason. I just need log some test data for something I’m playing around with. How should I do it?”
DevA: “If it’s test data, you should have wrote a unit test. You see, unit tests …”
- yammer on and on for about 5 minutes about the virtues of unit tests…never really explaining anything -
DevB: “Yea, I’m not needing to test the result or anything. I just need to log some data.”
DevA: “Then you should use a unit test for that, not a console app. With a unit test, you’ll be able to validate the data. That’s what unit tests are for. Microsoft should have never put in console apps in Visual Studio. It just leads to bad coding practices.”
DevB: “Um…I don’t care. It’s a console app because I just need data…thanks anyway”
Today, DevC was talking to DevA
DevC: “Charlie is testing the order module, but there isn’t any test data. Do you still have the data generating script?”
DevA: “Oh yea, I’ll send him my console app that populates the database.”
It was all I could do from screaming “You stupid –bleep-er!! What the f–bleep-ck was all that yesterday?!”, but none of my business. Better to devrant about it than start a fight. -
After 3 years of college, I have finally discovered the magical wonder of unit testing. All it took was me building my own application on the side to motivate myself to actually do it!1
-
First software refactoring in the company I worked for. No test environnement because "who needs it?", no unit testing, no comments, had to make sql updates and shit, was scared all day long that something would fuck up.
"Fuck fuck fuck, forgot a part of the where !" Had to fix everything quickly so no one would notice, no coffee/smoke pauses. On top of that, got a ton of retarded requests from the PM and other technicians working with me like "hey boi, could you add an icon to every button we made? There's like a thousand, we need it for tonight, our client will come visit us and I want to show him a better interface blablabla"
And since I was an intern, I couldn't refuse, had to work like a prostitute in virgin-land, and for what?
"Oi, you did good, now do other stuff"1 -
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 -
I started my actual gig as CTO of construction group (Innovation Hub) a year ago. And it was a hell of a ride, implementing kind of a scrum-ban for project management, XP, peer-reviews, a git-flow, git commit message formats, linters, unit testing, integration tests, etc...
And it's the fun part because with the CIO we had to drive the board to do A LOT of changes in their IT/Innovation drive.
But in one year there is a lot of KPI that went up :
* Deployment: When I arrived it took three stressful days to deploy a new version of one application, once a month. Today we do it every week, and it takes three annoying hours.
* We had no test. NOTHING! Today we have 85% code coverage for the unit test, and automatic integration tests run by our CI server every day.
* We had almost no documentation. Today our code is our documentation (it automatically extracted and versioned).
* We had 0 add value in the use of git. With commit messages as "dev", "asked task", inside jokes and a lot of "fix" and "changes". Today we have a useful git, and we even use it to create our deploy changelogs (and it's only mildly annoying!).
* More important, the team is happy! They get their purpose, see betterment in their tech mastery. They started doing conception, applicative architecture, presentations, having fun.
There is still a LOT of bad things we are still working on, and trying to solve (support workflow and betterment). But seeing what they already did, I'm so proud of my TEAM! I'm a fucking asshole, workaholic, "just do it" kind of guy. But they managed to achieve so much. Fucking PROUD!! -
I would describe the test project i inherited as a watermelon test suite,
Green on the outside..............................
Red on the inside -
Did your motivation ever suffered for company enforced tooling/stack?
I'm striving to be as adaptable as possible to not bitch if I have to use Angular insted of React or Java instead of Go but the stack which I was forced to use for the last two years is killing the joy I find in programming.
I'm talking about Spring WebFlux a stack which in theory is very promising (IO performances of NodeJS but in Java) but in practice is a pain to use: it makes polymorphism very hard forcing to rewrite tons of code, it significantly reduces your library choice, even after studying a damn book about it debugging remains a huge headache, unit testing often requires hacks and workarounds to be done...
Programming with it always feels like trying to fit a square peg in a round hole and I'm catching myself in procrastinating more and more, initially I feared I was burning out or losing my passion for the field but I noticed which the rare times I get to use a more canonical stack like .NET my motivation instantly returns but sadly I can use it only for few hours and then I return to WebFlux and my passion flees again.
I'm considering to look for another job but sadly lately I neglected my GitHub so I might have hard times in finding it.2 -
I have been keeping this inside for long time and I need to rant it somewhere and hear your opinion.
So I'm working as a Team Lead Developer at a small company remotely based in Netherlands, I've been working there for about 8 years now and I am the only developer left, so the company basically consists of me and the owner of the company which is also the project manager.
As my role title says I am responsible for many things, I maintain multiple environments:
- Maintain Web Version of the App
- Maintain A Cordova app for Android, iOS and Windows
- Working with pure JavaScript (ES5..) and CSS
- Development and maintenance of Cordova Plugins for the project in Java/Swift
- Trying to keep things stable while trying very hard to transit ancient code to new standards
- Testing, Testing, Testing
- Keeping App Stable without a single Testing Unit (sadly yes..)
- Just pure JavaScript no framework apart from JQuery and Bootstrap for which I strongly insist to be removed and its being slowly done.
On the backend side I maintain:
- A Symfony project
- MySQL
- RabbitMQ
- AWS
- FCM
- Stripe/In-App Purchases
- Other things I can't disclose
I can't disclose the nature of the app but the app is quite rich in features and complex its limited to certain regions only but so far we have around 100K monthly users on all platforms, it involves too much work especially because I am the only developer there so when I am implementing some feature on one side I also have to think about the other side so I need to constantly switch between different languages and environments when working, not to mention I have to maintain a very old code and the Project Owner doesn't want to transit to some more modern technologies as that would be expensive.
The last raise I had was 3 years ago, and so far he hasn't invested in anything to improve my development process, as an example we have an iOS version of the app in Cordova which of course involves building , testing, working on both frontend and native side and etc., and I am working in a somewhat slow virtual machine of Monterey with just 16 GB of RAM which consumed days of my free time just to get it working and when I'm running it I need to close other apps, keep in mind I am working there for about 8 years.
The last time I needed to reconfigure my work computer and setup the virtual machine it costed me 4 days of small unpaid holiday I had taken for Christmas, just because he doesn't have the enough money to provide me with a decent MacBook laptop. I do get that its not a large company, but still I am the only developer there its not like he needs to keep paying 10 Developers.
Also:
- I don't get paid vacation
- I don't have paid holiday
- I don't have paid sick days
- My Monthly salary is 2000 euro GROSS (before taxes) which hourly translates to 12 Euro per hour
- I have to pay taxes by myself
- Working remotely has its own expenses: food, heating, electricity, internet and etc.
- There are few other technical stuff I am responsible of which I can't disclose in this post.
I don't know if I'm overacting and asking a lot, but summarizing everything the only expense he has regarding me is the 2000 euro he sends me on which of course he doesn't need to pay taxes as I'm doing that in my country.
Apart from that just in case I spend my free time in keeping myself updated with other tech which I would say I fairly experienced with like: Flutter/Dart, ES6, NodeJS, Express, GraphQL, MongoDB, WebSockets, ReactJS, React Native just to name few, some I know better than the other and still I feel like I don't get what I deserve.
What do you think, do I ask a lot or should I start searching for other job?23 -
*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 -
TIL how time-delay relays are used in circuits with a hell lot of power. For example to power and control the motor of a machine that lifts 20 people up to the sky and back to ground again.
FYI this is a simple circuit. We will hopefully start experimenting with SPS/Speicherprogrammierbare Steuerung (Programmable Logic Controllers). I cannot wait to make use of our predesigned circuits with complex logic gates with the new unit we will get to know.
Unfortunately, we will do practical networking (testing cables for the signal strength and speed, building a network of telephones and call each other - guess this is going to be the funniest part lol, etc.) before the SPS and LOGO software phase.
Btw. I am doing an all-nighter rn and repeating everything we did in our recent signal calculation lesson. We have another exam tomorrow.11 -
Before i found out about unit tests i'd create a console application where i'd test the functions
Good times -
Working on my personal projects really shows me how rushed the work is were I work, and it drives me crazy.
I know my code works 100% in my current project as it is unit and e2e tested, so I can edit it until the cows come home.. at work though, different story. -
Once again, I have to go with the guy that, after seeing my horrible (I can't highlight this enough) code, decided that even I wasn't hopeless, and went on teaching me the basics of software engineering, top-down design and unit testing. All of this in two days, but it gave me the motivation to work on it, and look at me now: I'm a devRanter :')
-
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 -
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 -
So I decided today was a good day to manually compile python 3.6 for my raspberry pi as it hasn't yet been added to any supported repo's. Site says: this will take approximately 30 minutes.
3 hours later: "starting unit testing"2 -
I'm so happy that I have the first working version of the program. Just couple of bug fixing and unit testing and I'll push the code to production.
Day 1: Just couple of bug fixing and unit testing and I'll push the code to production.
Day 2: Just couple of bug fixing and unit testing and I'll push the code to production.
.........
Day 200: Just couple of bug fixing and unit testing and I'll push the code to production.
😞 -
"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/... -
During one of our 'pop-up' meetings last week.
Ralph: "The test code the developers are checking in is a mess. They don't know what they are doing."
ex.
var foo = SomeLibrary.GetFoo();
Assert.IsNotNull(foo);
Fred: "Ha ha..someone should talk to HR about our hiring practices. These people are literally driving the company backwards."
Me: "I think unit testing is complete waste of time."
- You could almost see the truck hit the wall and splatter watermelon everwhere..took Ralph and Fred a couple of seconds to respond
Fred: "Uh..unit testing is industry best practice. There is scientific evidence that prove testing reduces bugs and increases code quality"
Ralph: "Over 90% of our deployments are rolled back because of bugs. Unit testing will eliminate that."
Me: "Sorry, I disagree."
- Stepping on kittens wouldn't have gotten a worse look from Fred and Ralph
Fred: 'Pretty sure if you ask any professional developer, they'll tell you unit testing and code coverage reduces bugs.'
Me: "I'm not asking anyone else, I'm asking you. Find one failed deployment, just one, over the past 6 months that unit testing or code coverage would have prevented."
- good 3 seconds of awkward silence.
Ralph: "Well, those rollbacks are all mostly due to server mis-configurations. That's not a fair comparison."
Me: "I'm using your words. Unit tests reduces bugs and lack of good tests is the direct reason why we have so many failed deployments"
Boss: "Yea, Ralph...you and Fred kinda said that."
Fred: "No...we need to write good tests. Not this mess."
Me: "Like I said, show me one test you've written that would have prevented a rollback. Just one."
Ralph: "So, what? We do nothing?"
Me: "No, we have to stop worshiping this made up 80% code coverage idol. If not, developers are going to keep writing useless test code just to meet some percent. If we wrote device drivers or frameworks for other developers maybe, but we write CRUD apps. We execute a stored procedure or call a service. This 80% rule doesn't fit for code we write."
Fred: "If the developers took their head out of their ass.."
Me: "Hey!..uh..no, they are doing exactly what they are being told. Meet the 80% requirement, even if doesn't make sense."
Ralph: "Nobody told them to write *that* code."
Boss: "My gosh, what have you and Fred been complaining about for the past hour?"
- Ralph looks at his monitor and brilliantly changes the subject
Ralph: "Oh my f-king god...Trump said something stupid again ..."
At that point I put my headphones on went back to what I was doing. I'm pretty sure Fred and Ralph spent the rest of the day messaging back-n-forth, making fun of me or some random code I wrote 3 years ago (lots of typing and giggling). How can highly educated grown men (one has a masters in CS) get so petty and insecure?7 -
> colleague: My file has 79.25% of unit testing coverage
> supervisor: you're almost there! One final effort and you'll get that 0.75%!
Seeing someone this fucking dense is physically frustrating even when I'm not involved3 -
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 -
We rewrote the whole thing, except for iFraming some old pages in. We had to, the system was fucking awful and couldn't cope with any of the new mission critical requirements.
Client didn't understand the scope. Our project leader somehow snuck it in and we worked on it for months. We were sure we'd be kicked off the whole project... Somehow things didn't crash and burn. How it didn't blow up defies rational thought and the laws of physics. The new system worked, the client was happy, and boss made a lot of money.
Lead dev worked weekends for what feels like an eternity, it really was his baby and no one else on our company could have done it. It's where I finally learned how to do things the proper way; DDD, unit testing and TDD, architecture, building strong components in front-end, you name it. Before that I had a great nose for code smells and how not to do stuff, but now I got to see a proper system for the first time. It was glorious.
Then lead dev left and the system degraded quite a bit because new team didn't keep to the architectural patterns or general best practices. But we had a good run.1 -
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
-
rant?
When you want to write the unit test that demonstrates a subtle bug, but before recreating the same preconditions you end up writing 15 other tests, testing a lot of other stuff too, that in turn show other bugs, and skyrocketing the coverage (that was sitting at 0% actually).
Like I wanted to repair a hole in my umbrella to not get wet, and built a house instead. -
After writing ~200 lines of code and then unit testing it
THE TESTS ALL PASS!!!
then I run them again just to be sure and they all pass but mocha is saying I am getting 40ms lag on some of my tests...
Noooo!!!
This is meant to be an async message passing system; I cannot have an input lag of 40ms :(5 -
I've been working for two days (after work) on my blog idea...
Man I forgot how fun it is to work on your own projects, and the stuff I learn at the moment... It is insane!
I am currently a very happy developer, hopefully I can keep this up.
I still have to look into automated unit testing and code formatting checks with github though, cant wait! -
If I had a nickel every time the unit tests failed not because something was wrong in the code, but because someone had messed up the unit test I'd be able to retire early.
I just spent the better part of 10 hours hunting down a bug in some production code only for the test to be wrong because the person who wrote it had mocked the http response incorrectly.
Nothing I did to "fix" the code worked, because nothing was wrong with it...4 -
Hmm. Seniors have the half working experience as I do and I am the only not senior one in Dev team.
I adapt code only to "taste" good for code reviewers, but they allow themselves to commit without caring and just saying :"oh unit testing is boring"
Enough with the kindergarten. Time to prepare myself for the next job.1 -
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...
-
FUCK YOU GOOGLE
I feel I have zero control as a developer.. You made the shittiest choice by bringing in intellij , you made an even worse choice by adding gradle.. You add thousands of configuration options to manifests, layouts but provide no common place to find documentation for them.. This is just nonsense.. I've wasted endless hours figuring out your dex limits, proguard rules.. It's just frustrating.. Could you be anymore counterintuitive with your unit testing framework! Honestly it's a steaming pile of shit..5 -
So after 7 months of soul crushing searching I was able to land an awesome job I never thought I'd get! I didn't really get hired for my projects, I think I was more of a culture fit that knew enough of what they were talking about. My colleagues are awesome, helpful people but they are also clearly way ahead of me as devs. I know that many new hires have similar feelings and it's more a matter of drive + time. I understand that and I'm ready for the marathon ahead of me but I have one HUGE concern... I don't understand unit testing. I've never written unit tests in JavaScript or Java (just on paper I wrote random assert statements for a college exam question that somehow turned out correct). More importantly, I don't understand when to write unit tests and what my main objectives should be when writing them. At work they talk about unit testing like it's just as basic as understanding version control or design patterns, both of which I have had no problems asking questions about because I at least understood them generally. I come here looking for resources, mainly things I can go through over the weekend. I understand that I'm going to have to ask my colleagues for help at some point but I DON'T want to ask for help without any solid base knowledge on unit testing. I would feel much more comfortable if I could understand the concepts of unit testing generally, and then ask my team members for help on how to best apply that knowledge. I'm sorry for begging, I'll definitely be looking for resources on my own too. But if anyone could point me to resources they found to be helpful & comprehensive, or resources that they'd want their co-workers to use if they were in my position I would be very grateful!!!!4
-
Developer just emailed our team a complaint that our logging assembly was resulting in their poor test coverage and they sent a change request to give them the ability to mock the underlying log provider (ex. from the event log to ‘something else’).
Looked at their tests, and they are testing whether or not the .Log was executed (on an exception, if the .Log method was not executed, the test failed), which seemed a bit worthless because we’ve already got coverage in our unit tests.
We had a meeting to discuss the issue.
Me: “I’m OK with changing the logging code if it’s necessary, but I want to understand why.”
DevA: “Logging errors is crucial to the database transaction. If someone removes the logging, the tests should fail.”
Me: “If someone removes the error logging on purpose, then they likely have an agenda and will remove the test validation too. It wouldn’t be an accident.”
DevA: “That’s not my problem. They will have to deal with HR.”
Me: “We purposely prevented someone from intercepting the logging just for that purpose. Your test code already covers the business rule, testing the logging seems out of place. That would like writing a test to make sure the System.IO.File.ReadAllText actually reads all the text from a file. You kinda assume a few smart Microsoft engineers already wrote tests for that.”
DevA: “Yea, I guess that would be silly.”
Got cc’ed an email a little bit ago from DevA to his boss..
“We’re not going to be able to change logging assembly. This may have some impact on our overall test coverage as those lines of code will not get testing coverage. You will have to let the DevMgr know we will not meet our test coverage goals.”
WTF!1 -
Holy. Shit. Tests. I am testing. All week. Nothing but tests. I am one with the spec. You know what I realised today? Tests are a bit like life. Life is just one big spec suite that takes 75 years to run. Except there's no prod environment at the end of the DMT tunnel waiting for our green pass docket to say 'take me Lucifer, you absolute visionary: I'm ready'. We're all just a spec with no application. We're doomed. Nothing matters. I need to lie down4
-
Not leaning on unit tests. I usually write them after testing my code manually, and lose time for testing feature by hand.1
-
You cant be a recognzied as a good developer, untill you are a good tester or say produce least bug free code. You should do thorough testing of your code before handing over to QA. I lacked the skill of good unit testing, so have suffered alot in past years.1
-
Ok.. So I applied for a web dev position at a small-to-medium sized company. They had a telephonic round which they were happy with. They then sent out an assignment for me (A simple webapp to complete in 1hr). I did it and sent them the code. Finally, the face to face interview also went well.
At the end of it all, the HR comes back and tells me - "You did not use a MVC framework for the assignment and your code was not optimized for unit testing."
Me - "Ugh. (1) You did not have to call me for the face to face interview if you did not like my code. (2) You specified NOT to use any 3rd party libraries when doing the assignment. (3) You can tell people directly that you cannot afford them."4 -
I actually feel accomplished because I'm starting to turn one of my side projects into a real project, even if it isn't popular.
I have a discord bot (exclusive to one server, so more of a discord server) that I have been working on for a while with a couple minigames, like connect 4, crossword, blackjack, etc.
It started off very small, but now I see the project really exploding in size. I have a bona fide testing environment, website with domain and HTTPS with sitemap and everything submitted to google, unit tests, and the scope keeps expanding.
I am continuing to only add value, but have legitimate plans to try and make some income from it if things go smoothly.
Now I just need more than 10 users.2 -
#noestimates
I fucking hate doing estimates. It stresses me out. I just did it, for a requirement about migration. I'm on my way to a fight now with the PO, because "the estimated time is too long". There was an agreement that deliverables were not to have extensive documentation and unit testing will only cover 30% of each use case (I know, stfu), but that's gone so I have to do the whole thing. I estimated 160 hours coding time, 40% of that for docs and 50 for testing. I'm standing by it.
All that stuff aside, what bothers me the most about estimates is that there's lazy motherfuckers who say shit like "I can have their RESTful ws in 2 days, but I said a month, because fuck it" and generate a win-win situation for them and their company, because the client - practically everytime - will just argue for the task to be completed in barely 10% less of the estimated time, accept the proposal and be happy waiting, the developer will fucking dawdle and the company will be paid for more hours than it deserves. Ugh.
Fuck estimates.2 -
Because of all the devRant posts about unit tests, I decided to write a few to see how they worked.
They just saved me from pushing completely broken code to production. THANK YOU devRant!!1 -
"I don't think we should be playing with our privates {variables} like that" - framework designer
= context =
It was noticed that we have too many setter functions to change private variables just to do unit tests. So we had a small meeting to discuss what to do about this.
Options:
- don't do the test
- ignore till another time (ie: keep the functions till its a problem)
- put the variables into a provider
- use reflection (the above quote was a reaction to this option)6 -
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 -
*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 -
Me: Wrote and unit testing code for a user story.
Day of a Merge
PO: We need to back out the code you wrote. We have not gotten approval from legal.
Me: Uhhh well it's not going live for 4 weeks still and not harming anything but if you insist, ok.....
2 Days Later
PO: Ok legal approved the changes can you put that back in?
Me: 😡🖕🏻1 -
The company where i am working at currently is kinda weird. The company is run by a gujrati guy and he has placed almost all his cousins in high positions...and on top of that the CTO (whos the bro of the owner) micromanages people and also fires them on a whim...i am kinda worried that if i am not able to do a particular task, i would be fired too...He has asked me to do unit testing of some complicated functions on mocha/chai and i have never done all this before. I am not understanding what to do and there are no senior devs in the office who knows about these things...7
-
Finally back at the HQ and away from Offsite Hell after 18 months!!!!!!!!!!!! Real internet! Coffee on tap! Community of practice meetings! COOODDDEEEE!!!! Also back to devrant. Goodbye Indian devs from hell, j/k they still suck life out of my day with their deprecated ways.
Side note:
Switched to Unreal Engine from Unity recently and my god it is amazing! I definitely prefer being able to use C# with unity vs c++ with unreal but the blueprint system is a great visual programming system.
Unit testing is my new side chick. She wants me to leave my wife; I'm considering it.
Unrelated: Read Dead Redemption 2 is amazing.1 -
Ok ok ok, I will preface this by saying I am still a student so you can assume my complete and utter lack of experience.
There is all this fuss about unit testing and TDD but i still have my doubts about it. How is it that if your code works for certain inputs you can be sure that it will work for whatever can happen after deployment?
I mean, to my understanding testing can assure that some business requirements are cared for but as far as actual code correctness goes I don't see how that is achieved.
As far as i am concerned the closest it comes to complete code correctness is a mathematical type of proof but that should be impossible to be done effectively in an OO language.
How can you be sure that your code is what you think?
(If i have this all wrong please correct me)8 -
One responsibility of our team is general code QA for the entire dev department, DevMgr walks in our area yesterday…
DevMgr: “Has anyone reviewed the new WPF threaded model execution code?”
- everyone on the team responds “no”
DevMgr: “Can we get a review on that code ASAP? If it works as well as the developer said, it’s going to solve the lock up problems users are experiencing and automatic logging of errors.”
DevA: “Well, no amount of code is going to stop users from performing bad searches locking up the user-interface. That code is just a band-aid around the real problem. If the developers would write unit tests first …”
- rant about 5 minutes on unit testing that had nothing to do with why the DevMgr was here
DevB: “Yea, the code probably isn’t written to handle threads correctly. All the threading they’ve done so far is –bleep-”
DevMgr: “Oh, I wasn’t aware of that. Get me the results of the code review and if they don’t have unit tests, delete it from source control and let the developer know it’s not up to our standards.”
OMFG!! You have not even seen the code!
OK, DevA ..what the –bleep- does unit testing have anything to do with the user interface! You know the DevMgr is too dim to understand the separation of concerns. Shut your pompous ‘know-it-all’ mouth.
DevB…what the –bleep- have ever done in WPF? You manage the source control and haven’t written any C# in two years and never, ever written code for any significant project. Take that “handle threads correctly” and shove it up your –bleep-. Pompous –bleep-hole. Go back and watch youtube and read your twitter while the grown-ups get the work done.3 -
Every. Single. Time. I've tried to learn and implement proper Unit/Instrumentation testing, the main Android devs decide to go for something else or introduce some feature or Gradle plugin that breaks every tutorial out there. I find it way easier to just test everything manually than learning the new yearly trend. Am I the only one?1
-
Today I got bug report on code that I thought was fairly well unit and manually tested by me while I was writing it.
What happened:
Our QA was testing other feature and asked someone to deploy into his env other branch, without these changes, and reported that this feature is just straight up not working at all.
That report was kindda big deal1 -
So i'm working with people from another team to bring about a feature. I was wondering, "how come they're churning out so much shit in so little time!?"
Apparently, they make code, merge request to the release branch, and then do unit tests later.
How do people, in good conscience, think that they can skip unit testing for extremely vital components???1 -
When explaining unit testing:
"We tried but every time someone changes something in the database all the tests fail."
*facepalm*5 -
Just started a new job at a big co.
Expected to implement small new feature, no sweat about 30 LOC. Unfortunately no unit tests, no way to test without real data.
Spend 2 weeks trying to get it to run on the test rack. Lo and behold the entire testing system has been sitting broken for months and nobody knew. Why is all the documentation so vague!???5 -
Writing unit tests on a weekend and catching up on work that needs to be done because I m too busy on weekdays to have time to think about this...
The sad thing is test coverage is shit in the entire code base as boss just decided to start enforcing requirements now... And I have this huge migrating from legacy system project that needs to be merged. And we'll the legacy system is even shittier
So I have to write unit tests for shit code that was never written with testing in mind...
On the other hand I reworked some testing utilities to make it easier... For everyone... I want a huge bonus.... That I probably won't get...2 -
I got assigned to work on a new project a couple of weeks ago. We got the POC code handed off from senior management, since he came up with the idea over the weekend. The project concept is hella exciting, but the dev manager and PO I have to deal with make life unbearable to say the least.
We have only 2 devs (including me) and 1 QA on this supposedly very important project. Of course, management announced the project to the clients already, so now we have to deliver ASAP cause it adds “sizzle”.
The MVP deadline is... no one knows when, either July 30th or September 1st. The MVP requirements are... unknown. I swear if someone saw the list of tasks and issues attached to “MVP” Epic, they would call us nuts trying to fit it all in.
To make things better, each PR requires 2 reviewers, so we end up adding manager as a reviewer just cause we need him to hit that “approve” button. So in attempt to make life easier, we requested to have a third developer. We are getting another developer, but that guy doesn’t know how to unit test a pure function...
Current priorities are... unit testing with coverage of 95% and if we want to refactor code, we have to add area to the list in a Google Doc. As a result, we are not tackling big things like risk of SQL injections not to mention big features like i18n (5-6 languages to support by the way and yes, it’s part of MVP as well as SSR no one knows why). Currently, I spend 2-3 hours a week in calls with the team just to figure out what the hell MVP is, what we have to do and why we have to do it. Last time we spent an hour refining 1 spike and breaking down one story into 3.
Oh, we also don’t have a deployment plan, not even to test environments since DevOps team was not aware of this project at all. Thus, QA cannot create any test suites and have to test everything manually which eats a lot of their time.
This whole project is a big hot mess and I’m considering leaving it all together especially since I’m working on two squads at the same time. I love the project, I love the idea, but management makes it unbearable, so I’m not even motivated to work on that.3 -
Start with the simple things first then progress gradually.
Though I highly suggest learning unit testing as soon as possible. -
How many people do unit testing?. Am always caught my deadline. I just fix errors in production. The client timeline are not feasible2
-
Cocktail recipes list:
1. "Google's Ethics"
Take an empty glass
Add nothing
Cocktail is ready!
This cocktail is also known as "CPP – The Good Part", "Jumble Function Security" and "The Profit of Unit Testing".6 -
I've fallen in love with (unit) testing, it just saved my ass from deploying a broken version of my library because of a missing '!'3
-
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. 🤣 -
Starting to work with merge requests, unit testing, a shitload of different environments, Docker, Jira and stuff like that can be overwhelming for the first time, but it sure feels good to finally sit in the table with the big boys1
-
Started working as a "working student" in an it company to write unit tests. (which then will be executed automatically - so automated unit tests)
Realised that I write more or less the same code just changing the names and some parameters (sometimes more if it's not an number but a bool for example but it's pretty much the same scheme)
So I bought a tool for 1$ to use "auto complete" on custom templates.(I type testgetbool and the tool replaces this to the test case only asking for the variable name.)
So now I'm writing automated automated tests 😁😅
(which is btw pretty boring but cost & time effective)2 -
JS/NODE/MOCHA I HATE U....
SPENT ALL MORNING REVERTING AND DEBUGGING A BRANCH BC SOME UNIT TESTS FAILED.
THE CAUSE WAS NOT IN THE FAILED CASE THO.... IT WAS BECAUSE SOME OTHER JS FILE WAS NAMED *Test.js
ITS NOT A PROBLEM IN A LIVE SERVER BUT IT SCREWS UP THE SERVER WHEN ITS RUN IN MOCHA FOR ITS UNIT TESTING... -
Counted it out... 100k LoC frontend & backend... Not a single automated test. No unit testing, no integration testing, nothing. I've been asked to implement a CI server.
Halp5 -
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 -
Been wanting to get into OOP and unit testing, haven't found a single semi big project that I can use to study these techniques...
Wrote myself a class when asked to do an API call last week, and I think it looks pretty decent...
Does anyone have a ressource to just see how to do it "properly" on medium sized projects? (100k loc)6 -
*Executed maven build*
Me: What's this "no tests found?"
Senior: Nevermind it's not important. Just check if your code works.2 -
"You'll be doing X, and be sure to test everything you do. But we don't do unit testing. They aren't paying us for that."
- PM to intern coming via college (it's like a forced internship that counts as another subject for the degree).1 -
And here I am again, reading test cases that basically boil down to:
$testCase->foo = "bar";
$this->assertEquals($testCase, "bar");
$testCase2->foo = null;
$this->assertNull($testCase2->foo);
Why would anyone feel the need to write these kind of tests? They don't do anything. If I set up my mock a certain way, of course I will have that data, esp. if the unit under test only applies the data AS IS. (Funily enough through another component that already has the relevant dummy tests in place making these tests extra redundant and obsolete.)
You would think that one test case with dummy data suffices, yet no, there are like 30 examples that lie to you about apparent business logic cases, yet in the end the way you set up the mock decides what you will or won't get.
What's the point?6 -
Hennies I need your assistance!
My boss has put me in charge (wow yes I was surprised too) of figuring out what a good solution to our current testing nightmare would be. Therefore my questions for you are:
What kind of testing strategy do you work with at your job? Do you use any tools for it? How's the division of unit tests/service tests and/or UI tests?
I'd really appreciate you guys' input on what works (and what doesn't, in case you're living a nightmare with testing daily)10 -
I just want to use Jest to unit test my Typescript classes, but that appears to be impossible!
Testing the compiled Javascript instead doesn't seem to recognize any classname at all :( -
Jesus fucking christ! I've been hired by this bank to improve the quality of their online banking software. Zero unit tests and I'm tasked to make it testable as much as possible.
Guess what? Almost the whole fucking codebase uses static classes everywhere!!! Good luck unit testing that.... what a bummer. It is a challenge though.2 -
I just reviewed a pull request with a test case like (pseudo code):
# Test MyService
const mock = createMock(myService.myMethod)
.whenCalledWith("foo")
.returns("bar");
assert(mock.myMethod("foo") === "bar"));
Why though? Why are we testing the mock? What is happening here? This test has no reason of being there instead of a fuzzy feeling that we now have unit test to lure us into a false sense of security.
I asked why we don't do an integration test. Response was: "They are slow."
Well, duh, but at least they would actually test something.
What do you gain by asserting that the mock is working the way you set it up?3 -
Client and ex-Dev/manager wanted automated testing.... manager doesn't see a reason for interfaces... Still wants unit tests, and a SOLID design. Doesn't want to pay for the extra time needed. Good times2
-
I've never written any unit tests for any apps/programs I've developed.
I would tell myself, this time you're going to create some and be a better developer by doing so. I end up just creating the file and that's it.
Most of the bugs are discovered during the user testing phase so I always end up being lazy writing unit tests.
I write very defensive code though so that helps a little but all in all, it's a very bad habit that I need to snap out of4 -
How do you switch from testing while debugging (functional) to TDD unit tests?
Usually I test while coding by just running the use case and making sure while coding, bad inputs are caught/handled.
But most times I start with a general idea of the structure and what the about should be (which essentially would be the functional test case?)
I don't think about how you can break each part or the functions I need until I need them. Then usually start simple and then refactor. And until I'm sure each time I refactor would require changing the tests?4 -
Don't start the first semester teaching racket, especially when you're teaching documentation and unit-testing at the same time.
A few months later it was java's turn (same course), why dont teach that first?1 -
So I'm working on some communications app which bridges the main server/database with some equipment on the field. Now this equipment works in a redundancy pair: two cpus, A and B, both connected via ethernet, one active, the other standby/replicating and no comms on it. One obvious requirement is that when this equipment swaps the active cpus the comms app should switch as well. Fair enough, going with this into testing phase.
This guy, from qa, got some instructions from someone else:
1. Trigger the soft switch from equipment so that cpus got swapped.
2. Remove the ethernet cable from the standby unit.
3. Observe the communications.
And the test goes like: cpu A is active, B is standby. Switch is triggered, B becomes active, A goes into standby. The cable is pulled out from cpu B.
Test result: failed, no comms ever4 -
Before I started working, I used to feel like I depended on documentation and the internet a little too much owing to ultra crappy long term memory. After spending some time at my internship going through code written by "professional developers" several years senior to me and trying to write unit tests for it (surprise: the code was in production without having underwent any sort of testing), I feel like the amount of time I spend online reading usage recommendations, alternates for optimisation, best practices for writing clean and descriptive code and all that is a lot more rewarding. Some bad things help you feel good about yourself.
-
Am I the only one to think companies asking questions such as those for technical interviews don’t understand what software engineering/development is about ?
- How many layers does a webservice have?
- What framework do you use for unit testing ?
- How do you do dependency injection ?
Essentially questions that they deem black and white but really aren’t. Besides isn’t the core of the work to just adapt and learn while being smart about what things you implement ? I don’t get these questions for me it’s a sign that a company doesn’t understand the work I’ll be doing.
I think for a technical interview I’d much rather spend my time on a difficult algo question in the language of my choice for 30mins - 1h than 20mins answering close minded questions that don’t have to be.
This rant is mostly due to the fact I’ve done a few interviews with two companies and both behaved like that, I’m 100% certain I had the skills to do the jobs they were offering me (they both contacted me first) but both ended up denying me because my knowledge on their specific questions wasn’t detailed enough. I could have learnt their stack in about a week so I don’t know why that mentality exists.
I might be wrong about the core of the work though… what do you think?3 -
Working with a data scientist on an update to a machine learning api that has dinner logic change with a new model.
He's wondering why his PRs are falling.
He's trying to merge into development from a branch created off of main.
He's renamed all the functions and classes and never updated the call points.
He's using new packages but never includes them in the requirements file, so the docket builds are failing.
His class method definitions don't contain self and are throwing syntax errors.
I've been working with him for 4 days to get him to understand branching, linting, unit testing, and not blindly copy and pasting snippets from jupyter notebook into production api code!8 -
My brain hurts from trying to figure out this unit testing crap. Is it just me or is it really a struggle to test your front-end code? I'm using jest and enzyme to test our React app but complicated parts of code with multiple state changes or calling props is making my life a living hell. I mean I usually just debug by console logging everything and it works lol...but my fucking boss has forced me into writing this unit testing crap. FML.7
-
Anyone know how to go about unit testing an application that is made up of:
- Electron
- Node
- React
- Typescript
(React using Typescript of course).
Electron has its own framework (Spectron), people seem to use Mocha with Node, React has its own tools like React testing library (and testing UI components will probably end me) and Typescript seems to play best with Jest - but a special Typescript flavour of Jest called ts-jest is preferable because the only other option is having Babel and its Typescript support that doesn't type check.
I want to beg for the sweet release of death.4 -
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 -
Writing code for software that was deprecated since 2015 it's a nightmare. More when the unit tests take way more time than the actual fix or feature. Just kill it with fire
-
Couldn't sleep most of the night because was thinking about dependency injection (Spring) and unit testing...
And came to the thinking that pretty much every time you need to create a new method it should be in a new class, wrapped with and interface?
So then how do you decide whether to create a new class/interface vs a private method in an existing class?7 -
Why does it have to be so difficult to get unit tests to run? Spent about an hour yesterday trying to get a single test class to run and it kept complaining about a compiler error in a completely different module. Went to the file and there was no error. WTF?!
In the end, checking the “delegate build actions to gradle” box made it go away. why..... -
In my first few months of my first dev job, I written this fragile piece of code in, trigger warning, PHP that sent out email reports to my clients. It was a two men team, and we have no clue about TDD or how to do unit testing for such code. We would just run that piece of code manually do send out dummy emails to ensure things were working.
One day the code broke. I was told by my boss to fix it. Spent the entire day trying to fix but couldn't get anything done. Finally at around 7pm my boss came by and asked why is it I couldn't get it fixed. He helped me troubleshoot and fixed it. And subsequently told me "c'mon man you're better than this."
It turns out that he changed a part of a code that was supposed return an array of strings to an array of objects, adding a second attribute that wasn't even in use.
So what that meant is that he changed a piece of working code, to include a property he didn't need, committed and push to production without even manually testing it. AND TALKED SHIT TO ME.
That was the day I learned git blame and began my journey on TDD. -
The job description of my internship:
You must be able to understand the complexities of receiving a unit test that you are told needs only mock data in the test database, but has never worked since it was written by a contractor a year ago. No one knows how the unit test works and requires testing a complex algorithm involving graph theory that you have not learned about yet. The task starts at 1 complexity and turns into a 13. -
Our systems lead is trying to tell our software person how much adding unit tests would cost. It also sounds like he wants TDD to be added in after the fact. And he's bitching because the software guy won't move forward with it until we get it with the customer. He also wants all of them automated, but doesn't want to accept that that is going to cost a lot. Like a lot, a lot. This is a guy who doesn't know algorithms (had to explain dykstra to him), doesn't understand the tech stack we are using (I had to explain .net versions, the JIT compiler, and garbage collection to him), and seems not to understand hardware (I had to explain floating point math to him), yet he feels qualified to tell us how long it is going to take us to implement automated unit tests for major, complex features.
-
Trying to learn JavaScript unit testing with Vue.js and it's not going well. Took long enough just to get everything installed and now it errors as it doesn't understand <template> tags. Why is it so difficult?
-
Currently having very funny project lead, who gives on the spot estimates for 9 years old very pathetic quality code having Android app in security domain. Memory leaks, bad practices, typos, CVEs etc. you name it we have it in our source of the app.
Since 5-6 sprints of our project, almost 50% of user stories were incomplete due to under estimations.
Basically everyone in management were almost sleeping since last 7-8 years about code quality & now suddenly when new Dev & QA team is here they wanted us to fix everything ASAP.
Most humourous thing is product owner is aware about importance of unit test cases, but don't want to allocate user stories for that at the time of sprint planning as code is almost freezed according to him for current release.
Actually, since last release he had done the same thing for each sprint, around 18 months were passed still he hadn't spared single day for unit testing.
Recently app crash issue was found in version upgrade scenario as QAs were much tired by testing hundreds of basic trivial test cases manually & server side testing too, so they can't do actual needful testing & which is tougher to automate for Dev.
Recently when team's old Macbook Pros got expired higher management has allocated Intel Mac minis by saying that few people of organization are misusing Macbooks. So for just few people everyone has to suffer now as there is no flexibility in frequent changing between WFH & WFO. 1 out of those Mac minis faced overheating & in repair since 6 months.
Out of 4 Devs & 3 QAs, all 3 QAs & 2 Devs had left gradually.
I think it's time to say goodbye 😔3 -
Coworker: "Hey, so I discovered this library that automatically brings up and tears down local containers to perform unit tests on data sources"
Me: "Sounds neat"
Coworker: "Yeah, I've been messing with it locally, and it means we don't need to have the data sources installed on our machines or rely on the ones in the testing environment."
Me: "That's good"
Coworker: "Just a shame I had to roll back our testing framework to a previous version and refactor the code in all our other tests as a result."
Me: "Wait what? *looks at documentation* It says they support the newer framework"
Coworker: "Yeah, but I couldn't get it to work. So I'm just gonna make a PR for it, okay?" *Proceeds to make a PR, approve and merge the code before I can comment further on the changes*
Welp, there goes all my motivation to get anything done for the rest of the day.3 -
How do you think about unit testing/TDD when writing apps? (I'm working this at 3am so might be a bit messy... Just a thought I woke up to).
Whenever I write an app, I don't write unit tests but as I'm developing I may create test functions for specific parts that I run to validate a specific component is working before moving onto the next.
So first, when I get a problem, break it up into components based on the requirements. It's usually sort of input, processor, output sequence.
Where the processor is essentially the core app. And so I start coding it, referring to the input thru an interface, model objects, adding fields as I go along (assume no matter what the input, I will get these before the logic is called). I may add some more interfaces as well for other data I may need but I know won't be going in the first input.
So I write all the logic, functions needed to get a basic app to run that does what I am writing the app for.
Only then do I write a test functions passing in different parameters to make sure the logic and response is what I want and making fixes as necessary. At that point I basically have the simplest version of the app.
(I guess this is sort of like mocking?)
Then build outwards implementing and testing components as I go along and may do some simple refactoring/redesign. (I guess all these tests are functional then, have to start the whole app).
And finally when I have the basic requirements fully complete I will add the "nice to haves" on top via refactoring of specific logic in specific components. Again testing by running the app maybe with simple inputs.
I guess now I'm thinking how do you write unit tests/TDD if the app keeps changing (via adhoc refactorings) as you are creating it? -
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 -
So we have duplicate code because dumb devs thinks Bootstrap (4) is kick-ass for mobile. 😒 Can't do jack with their tables.
I told them to use Flexbox instead. Bootstrap (even 4) is antiquated and there's better options.
My recommendation is to use Flexbox Grid with React to build a modular living style guide with built in unit testing for styles and interactions.
Basically got told that my opinion is just an opinion and is the same as using Bootstrap. 😭
Anyone have some solid "facts" on Bootstrap I can use in the long run? We haven't even launched anything and we're already in technical debt because of this stupid framework decision. Someone please help. 😞3 -
when i look at the code structure of the project i work on with my friends, i always think about how to implement the SOLID principles of bob martin for clean code
... and then i think about the clusterfuck of almost unmaintainable code that has been created over time and all the unit testing that doesn't exist at all and how much time and effort it would need to correct that code and how i realize that i don't even understand the principles and how to implement them
... and then i give up and go on coding even more mess
... and then i repeat😅😖😩3 -
1) receive functional requirements
2) create functional specification, post it on forum (no jira)
3) create memo document, post it on forum (no jira)
4) create analysis document with actual code changes without seeing the code (wait for step 8), post it on forum (no jira)
5) receive review on analysis document, fix it and post (no jira, redmine etc from now till the end of rant)
6) after analysis is approved make a checkout request
7) source code manager checkouts files from svn and posts them on forum along with the files list
8) you make actual changes to the code, post changed sources on forum
9) source code manager makes a review to check that amendment commet is present in source code and is properly tagged, and every line of code chnged is properly tagged (you are not allowed to delete anything, not even one space, you need to comment it (and put an appropriate tag))
10) after you passed review you fill in standard compilation request form
11) you code is compiled and elf is put on testing stand
12) you fill in "actual behaviour" and "expected behaviour" columns near description of changed function in template of unit test plan document (yeah we have unit testing) and post it on forum
13) if testing ok changed sources and compiled elfs along with its versions (cksum) commited to svn (not by you, there is a source code manager for that)
14) if someone developed function in same source file as you "commited" he is warned by source code manager and fills checkout request form again
15) ...2 -
I frigging hate unit testing an AngularJS application. The amount of mocks you need to create just to test a a piece of code is unbelievable1
-
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
-
How is it possible that nextjs developers could build a much more sophisticated web platforms than i do, much faster much more rapidly and easily and ship it to production for almost no costs, not even using any devops pipeline, unit or untegration testing, while i do all of that + devops and it costs me to pay for servers on aws?????
Literally what a nextjs developer can build in 1 month it would take me at least 3-4 months11 -
What a mess ^^
From one moment to another unit-tests on my local machine stopped working.
There was a PHP fatal error, because of insufficient memory.
Actually, there was a ducking "unit"-test of a controller action "log".
This action returns the content of the projects log file...
Since this log file grew over the time, PHP tried to assert the response of the controller action which was sized about 400MB.
C'moooooon guys!
What were your thoughts behind this bullshit? ^^ -
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
-
I have reached the conclusion that angular and tdd don't go together well. Component tests take forever to run.
-
NodeJS’s transition from CommonJS is still a bit of a mess. Jest is the most used unit testing tool, but you need to fondle its balls to get it to work with ESM. Jasmine is the only major testing framework to support ESM out of the box. Luckily, jasmine is actually really nice.4
-
How the fuck do I handle self-called senior developers who do not want to do testing (writing unit tests and manually testing) in an agile environment where there is dedicated tester anymore?
They behave like fresh programmers out of college only wanting to write their code and nothing more. We had a dedicated tester role but that guy left the project. -
Started adding new MVC project to main solution at work. Started getting assembly reference errors across the projects during testing. Figured I might as while update the few assemblies that are complaining instead of trying to downgrade to maintain the current state of things. Shouldn't take too long right?....8 hours of staring at configs and running and rerunning nuget commands to get all the versions lined up across 120 projects....thank God we have extensive unit and integration tests...
-
Only when the latest feature is implemented, the last bugfix and the last workaround are found, the last unit test is written, the latest CI/CD pipeline done, the customer guy does manual testing and acceptance tests on the staging server and let's them pass and a few days later it's pushed to production...
You will be reminded (again) that shitty customers do exist! A customer is the least capable person to tell you what the customer actually wants and is also the least trustworthy person to test the features he requested...
Holy fuck come on! Just test that shit on the staging Server! One Look could have already shown you that that's Not what you expected!
I checked the logs after that and yup you guessed correctly... The said endpoints weren't even used on staging, only on production...1 -
Airflow… airflow… I hate you so freaking much, you are a bloated piece of software that packages wayyy too much and increase the complexity of any solution we built on top of you. Plus unit-testing and integration tests are wayyy too difficult with you. But man… your recent UI changes are a massive welcome.
A year ago I was tasked with either upgrading airflow to version 2 or to migrate the code to another tool. Naively I thought “well might as well upgrade to avoid a rewrite”. Little did I know that the reason airflow didn’t scale out well for us, was due to people over the years not having a grasp on airflow primitives like “pools”, “workers” and “operators”. Ended up refactoring the entire codebase for both infra and DAGs anyhow AND upgrading the beast AND lower cost by a factor of 2 (from $100-$150 daily to $50-$70 daily).
But seriously feels like I could’ve solved the scheduling issue with literally any message queue+decent library (like celery or Faust) and I’d have half the headache.3 -
!rant
Using Java is there a framework for building functional tests?
For unit testing we use JUnit but when I'm writing my code, often I need to debug against an actual db, for example, to be able check it actually will work and return the results I expected (and mocked in the unit test).1 -
Vague requirement for feature A received from client
Business consultant refines
Example mapping done
Acceptance criteria defined
Scheduled in sprint
Development done
Unit tests passed
Pull request reviewed
Code merged and deployed to system test
Functional testing successful
Deployed to UAT
Client asked to sign off
Client: "Actually I don't want that feature." -
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 -
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 -
Unit testing with NSubstitute and Autofac
For the most part, I find it a lot simpler than SimpleInject (hmm) and Moq, which I have used previously.
But there are still some of those 'Oh, for fucks sake!'-gotchas.
I was trying to test a class today where I wanted to substitute all other methods in the class than the one I wanted to test == an actual unit test.
I had previously found out how to do this:
1. Make sure the methods that should be substituted are internal to allow substitution.
2. Substitute class with Substitute.ForPartsOf<T>(args)
3. Set up methods that should not be called with instance.When(a => a.Method()).DoNotCallBase()
This way, you can unit test a class properly and only call the method that you want to test, and also control the return values of the other methods if needed.
So as I said, I have used this before to great effect. But today I just could NOT get it to work! I checked and rechecked everything but the test code kept calling the implementations of the substituted methods!
I even called over another dev for help, but he couldn't see the problem either.
Aargh!
I scoured the internet, but everyone just told me what I already knew: follow the 3 steps, and all is well. Not so!
I ALMOST considered doing the test improperly, as in, increasing the scope beyond that of the method I wanted to test.
But then it hit me... My project was missing this line in AssemblyInfo.cs:
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
I always add a line to make internals visible to the test project, but I had forgotten that NSubstitute needs this line as well to work properly.
Sometimes when a test fails it will tell you that you are missing this line. And sometimes it just doesn't work.
Maybe I will remember this in the future now. Maybe 😅 -
I hate unit test. I hate testing by code.
I hate the idea to write code that tests code. And that u must update both when u add a feature. Like wtf.
Good debug mode with clear verbose and precise reporting tool and voila.
Drives me nuts thus trending shit.10 -
Haven't done much work on my game since December. Ok so I havent done anything on my game since December. Learned Mockito and JUnit formally (finally) because that's what we'll be using at work.
Never really learnt unit testing prior, just knew it's power. I just need to find the right unit testing and mocking frameworks that work well with .net, C# and Unity3D and I'll be great.
I'll finally attempt to properly test that (those) annoying part(s) of my game. So many vectors to work out and often the object is moved to or along the wrong vector.
I'd always only imagined having to use stubs which is why I've never understood how unit testing would really help in such a dynamic environment as video game development. Especially as a one man team. Mocking is about to be my lifesaver.
Anyone able to suggest a good testing and/or mocking framework for C#, .Net, Unity3D? -
Any of you experienced Devs have any recommendations book wise for backend development (framework, unit testing, vcs, server deployment...) For java.
FYI I do have a LITTLE experience with MVCs6 -
After 30 minutes of fixing the code I finally noticed that someone switched the position of "actual" and "expected" when writing unit tests.
-
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
-
Looking at jest errors and loads of GitHub and StackOverflow issues, it's no surprise that people claim they don't like testing.
Maybe they would if we got our tooling right.
import { foo } from 'bar';
Nah, that's an unexpected token, jest does not like this syntax.
Using require, like in jest's getting started tutorial isn't compatible with my existing JS libraries exports.
Adding type: "module" in package.json just makes another error message appear instead.
Fucking developer experience!
Why bother with unit tests at all?
How come PHP is 10 years superior to JS when it comes to code quality, unit tests, and static code analysis?
I don't even care about "ES modules". I don't want to "mock" anything either. All I want to do is import a handful of JavaScript functions into another file.
Overengineered web dev stack sucks!3 -
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
-
Today I escape from the clutches of the legacy iOS project ive been stuck in for about a year and a half.
Starting on a new team, totally different stack (TypeScript/Angular).
Its bad that what makes me happiest is that we have unit tests, something thats been missing from my life for so long now. I might actually get to do TDD now.
Life is good. -
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. -
What's your worst case of documentation examples that only cover the most basic of use cases, along with API docs that just repeat the name of the functions with some punctuation... angular js unit testing docs for me1
-
Read this and tell me OOP (or at least C#) isn't broken:
https://levelup.gitconnected.com/5-...
All I want to do is mock System.DateTime is for a few of my tests, and I ended up going down this rabbit hole of absolute horseshit: build a custom class that you can mock in tests, blah blah blah blah, uhhhh... YEAH NO
Such a simple functionality / need, and yet there is no easy way to test for it. Sigh.16 -
I'm so fed up why stupid fucks who yell to everyone "You must do TDD, because... Reasons!!!!". The fuckers even dare to call themselves " agilists" or "craftsman"...
The only reason to do TDD is to create Good Unit Tests. But by not stating the main purpose, you add a stupid process without add value.... The solution just became the problem!
So what if something goes wrong? Well, you didn't really followed TDD, because TDD never fails!!
So fuck ignorant stupid fuckers!!!!!
Having Good Unit Testing is the aim. TDD is one way to do it. Not THE WAY!!!
Also, stop using the word " coverage". It doesn't mean fuck!! If you know what kind of coverage you are completing, there could be some value...6 -
Online resources that discuss testing recommend the following pattern when writing your unit test method names:
given[ExplainYourInput]When[WhatIsDone]Then[ExpectedResult]()
This makes developers write extremely long test method names.. and this is somehow the acceptable standard? There must be something better.. I think I've seen annotations being used instead of this.5 -
When you work on a project for months, the newly appointed tech lead says "we all (him, the boss and other colleagues not involved in this project) looked at your code and decided that it should be dropped and we are starting from scratch again....now I'm not against code review (which we never did) so I welcome the input but allow me to vent my frustrations about how this is being done. Also to have a review & verdict without me being present?
So I ask what was so wrong:
* You changed the database structure. Valid, I tried to make your db an actual db with relationships, so I added some foreign keys, delete fields that were never used, all because they told me to use an ORM.
* You used to much logic in setters, validation etc, valid again but this would be something we could look at and fix imho.
* You are passing classes in your constructor, valid I wanted to use DI to make unit testing possible. Ohh but I don't like unit testing so I don't see the point and it makes it to complicated was the response.
So not only was the project cancelled, the new iteration is being developed without me, I'm shunned from all meetings. Ohh and from what I see they are now using 5 tables instead of 25 and completely started the db model from scratch...5 -
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 -
Power BI: wonderful tool, pretty graphics, and can do a lot of powerful stuff.
But it’s also quite frustrating when you want to do advanced things, as it’s such a closed platform.
* No way to run powerquery scripts in a command line
* Unit testing is a major pain, and doesn’t really test all the data munging capabilities
* The various layers (offline/online, visualisation, DAX, Powerquery, Dataset, Dataflow) are a bit too seamless: locating where an issue is happening when debugging can be pain, especially as filtering works differently in Query Editing mode than Query Visualisation mode.
And my number 1 pet peeve:
* No version control
It’s seriously disconcerting to go back to a no version control system, especially as you need to modify “live code” sometimes in order to debug a visual.
At best, I’ve been looking into extracting the code from the file, and then checking that into git, but it’s still a one-way street that means a lot of copying and pasting back into the program in order to roll back, and makes forking quite difficult.
It’s rewarding to work with the system, but these frustrations can really get to me sometimes2 -
Sometimes I deploy to production without actually testing the changes. At least I have my unit tests!
-
New Project
M: Hey, check these two processes. Both took different paths for the same input. Here are the logs. Both are the same though.
Me: Ok... do we have a debugger?
M: No this product doesn't have a debugger
Me: Any unit tests i should know of?
M: We don't do unit testing. Everything is done in Integration Testing.
Me: Ok. So how can i check the db for this?
M: You can't, the access is restricted. You'll have to raise a ticket to other team with the sql output you need.
Me: Ok. So I hope you have the schema at least.
M: Yes we have the schema. But there was some issue last week so the values might not be there in the correct column. They may or may not be present where they are supposed to be.
Wtf am i supposed to do... fucking play football on ticketing system with the other team 😐 -
Anyone using nose2 as their primary unit testing framework?
If so, why do you prefer it over pytest? The nose2 homepage effective recommends pytest, so wondering about the future of nose2.2 -
The heck is wrong with the testing framework. I can obviously see that it a correct value why doesn't the test case pass.
FAILED:
REQUIRE( positive==static_cast<double>(0.7352941176) )
with expansion:
0.7352941176 == 0.7352941176
===============================================================================
test cases: 1 | 1 failed
assertions: 1 | 1 failed10 -
This is brilliant example of why integration testing is so much better than unit testing https://twitter.com/withzombies/...4
-
I understand unit testing and its value but I’m really struggling when I have to mock databases or other external resources. It’s normal or others have this annoyance?6
-
Does anyone have experience with unit testing AutoCAD plugin applications? And || or UI testing?
Because you need a running AutoCAD application to test commands and functions it's very difficult to test the AutoCAD related methods.
I would like to know how you do it. -
It's like my life is divided into two parts these days. Some days I wake up and the sun is shining and everything feels good. Other days I wake up and remember that I'm going to be working on writing unit tests all day. :/
-
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 -
# ./symfony test:unit
Propel-Exception: Unable to execute DELTE ALL statement [...] Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails.
WHY ist a UNIT TEST reaching out to a REAL data base?
And who in their right mind would create a different data base schema for the tests?
This was with a clone of the real thing. Removing the FK results in double PK-errors...3 -
Hey, can someone point me to a sample project (if it exists) on the best way(s) to stucture code for Serverless architecture that includes GraphQL and unit testing?
Preferably in NodeJS. I'm more interested in the code structure than anything else. -
I really don't know what to do when I can't get the help that we need.
We use the initial version of Jasmine for unit testing and AngularJS (not 2, 3, 4+, but 1), so it's hard to find any good examples online to create my tests. My coworkers help, but since testing isn't something we do at all (or at least very often), they are unsure on how to help me.
I don't know what to do. I feel very unproductive and not valuable to the company at this time.2 -
I'll do the tests later on it'll be fine. 3 releases on, There are bugs everywhere - I cannot handle the regressions. Why'd this happen..Yeah.. Really need to do some proper TDD at some point.
-
Behold! This is the first time in my career when Jest and unit testing in general actually helped me 😂
Spent two days moving from a fucking slow piece of crap called Gatsby to Vite, trying to comprehend the difference between TS aliases, Babel aliases and Linaria aliases. Found an answer inside a totally unrelated issue explaining Jest stuff, good job on documentation, Linaria!
Vite is fast. Crazy fast. Forget about Webpack, Parcel and things alike — Vite doesn't even need to bundle JS.
Gatsby was slow to the point of my computer's audio glitching, I'm not even talking about the OS interface lags.
Vite is fast to the point that I don't actually need a new MacBook.1 -
Jest/enzym unit testing: My lead developer says using shallowWithStore instead of shallow on one incidence would introduce CPU overhead thus I MUST stop whatever I'm doing and fix the pull request. Is that normal?
-
Upgrading my tech skills.. Once again I feel my personal my personal dev environment and told are much more up-to-date than what I use at work.... Though the book Kim reading is on TDD and was written 3 years ago.
Maybe I should read another on in cloud services and ML... but don't have any motivation for these topics.
I need TDD for work because now we're emphasizing unit test coverage...
I usually only use manual functional tests to verify the final outputs as either the testing framework is broken (JS) or I don't have time to relearn the frameworks for the particular language...
Anyway got off topic... So questions after:
1. Do you ever feel your technologically always more ahead than what you do at work and essentially you bring skills to the job but you don't learn much out of it?
2. How do you test? I actually got into a bit of a argument/discussion with my colleagues about how to implement unit tests. Apparently there are 2 ways to test? Black box vs WhiteBox. She said she tests only Public methods using mock inputs, dependencies. She read online and seems there is an opinion that should only test public functions and if you can't then your app is designed incorrectly, not separated enough.
For me I test the private functions individually (WhiteBox/Java reflection) because the public one is like generateReport and as a whole is like a Pachinko machine, too many unique paths that would need a test case for.
So thoughts? Yes sorry for turning it into a remake I guess...24 -
What should I do, I have a central function that is not documentated and no test-cases are written for it. I have no clue what the method should really do, I know that it works in 99.9% of all cases otherwise we had much more bugs. Now there is one Unit-Test that reports an issue. I tracked it down to this method, no one touched the method nor the unit-test.
My logical thinking says that there is one statement missing, but it could also fuck up another part of the code... (This project has a bad testing coverage :'( )
What would you do?
- copy paste the method for this special case (I would hate me so much for breaking DRY)
- inheritance?! (Would make it more complex and then it would be still untested / undocumented)
- YOLO changing oO?! (hope for luck, just joking)
P.s it's an edge case unit test, the client / customer probably wouldn't realised it if it happens -
What stack are you using to test your angular app and why?
We’re using Karma + Jasmine for writing unit tests, because it’s the default, and run them on GitLab CI in a Docker container. For UI testing we don’t use the default Protractor but Selenium, because we haven’t found a way to run Protractor tests with a dedicated webserver.1 -
That beautiful moment when you run a #xcode test that you know must fail but you get the green lantern ¬¬
-
So I am working on a Java library with minimal dependencies. Everything goes well until you dont want clients knowing how to construct the internal objects and you dont have a depenency injection framework to help.
Unit testing becomes that bit trickier1 -
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... -
how do I test long scenarios? I have an app with 10 screens to complete. I have a dropdown on the first screen which creates a table row element on the last screen. should I do selenium or unit test or both? selenium will have to click through the whole app and call every API just for 1 assertion. unit test will only check the dropdown has the right options which are subject to change and not really worth testing. I run into this problem every time I want to write a test. i always miss something in my manual testing and introduce defects. what should I do?2
-
Just built out my first app using Cloudflare Workers, Typescript, and DurableObjects. Holy shit, this is nice stuff.
It's taken little to no time to build out:
* JSON API written in Typescript
* JWT verification against my OAuth backend (SAML support too)
* CI Automated Deployments including unit tests
* DurableObject support
* 3rd party HTTP calls + caching (built in to the framework!) to reduce network latency and hiccups.
* Cron-like tasks on each stored object so they can awaken the app on a schedule and update themselves as necessary
* Rapid deployment to new environments
The local testing with coordinated "miniflare" is dreamy too. -
I am into web development but I handle small projects and I just want to ask does unit testing/Integration testing done by the developer or for testing there is different department? I mean do I need to learn how to write test case too??6
-
Thanks sefuckalize-mock for not letting me insert 2 row,
Now Im replicating the whole sequelize module itself to stub shit for no reason idk fuck this why am I doing this for stupid unit testing -
I got some problem. I work on some company maintaining web application. Every time I add some feature I often accidentally break other features. I read about testing (unit test, integration testing, etc) and ask my project manager and CTO to implement test on our web application but they refused it. The reason is because the web application is already large and it will take a long time to implement. Actually maintain this application is very stressful because it takes along time to add new feature and every time I break something either CEO or Client will scold me. Do you guys have idea/solution to solve this problem?1
-
Hey Folks,
Does anyone use React Testing Library for Unit testing React components?
If yes, how do you imitate the user event "CTRL + B"? -
For the old school gamers out there, today I realized that the method by which the Temporal Security Annex detects temporal disturbances in the game The Journeyman Project is, effectively, unit testing time itself.
-
I have actually two, but I'll write the other one in the week.
So we had classes about software engineering. The class was interesting but the teacher wasn't. Too soft, too slow, too low, too monochord (usual french), it was boring. So we ended up not listening to him. Kinda regret this.
We got a first exam, where we were in group to develop a Test Manager for Unit Test (yep.)
We had instructions, like the note would be multiplied by the percentage of coverage of code, etc.
The thing is, we really didn't get the point of the project. Now that I think of it, it seems obvious, but it wasn't back then as it was too new. In the four people of our group, one worked real hard on it, I tried to do my best, the others too.
But like I said, I didn't get back then the point of the topic, which is to apply design pattern, unit testing, etc. It was furstating af and we ended up with a 9/20.
I got the point of the topic only for the second exam, the most classic one, on a paper sheet with questions to answer. (We were allowed only one cheatsheet, I understood the topic while doing it. Sad, huh ?)