Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
Search - "mocking"
I was a little too harsh on a colleague today.
He asked to help him get something working... After looking at it for a bit, I asked: "I don't get it, what have you been doing all day? Yesterday we split this element into two separate divs, and it worked perfectly, now I've see you've moved all the styles back to the container and there's only one div. The easiest way to get this to work properly is to simply undo everything you've done today."
He looked at me with puppy eyes and I realized I was too harsh. He wasn't _trying_ to break everything, he just hadn't understood why we split the element into two divs. So I lowered my tone a bit, and explained everything again, from the start, then did it again together with him and made sure he understood the separation.
But I still feel bad for how I talked to him. It's not like I shouted or cursed or anything (and I curse a _lot_ when talking about code). It was just condescending as fuck, and belittling. As if I was mocking him for not being as experienced as I am.
I'll do better next time.8
Keep it simple, stupid.
At the beginning the project is nothing but an idea. If you get it off the ground, that's already a huge success. Rich features and code quality should be the last of your worries in this case.
Throw out any secondary functionality out the window from day 0. Make it work, then add flowers and shit (note to self: need to make way for flowers and shit).
Nevertheless code quality is an important factor, if you can afford it. The top important things I outline in any new non-trivial project:
1. Spend 1-2 days bootstrapping it for best fit to the task, and well designed security, mocking, testing and extensibility.
2. Choose a stack that you'll most likely find good cheap devs for, in that region where you'll look in, but also a stack that will allow you to spend most of your time writing software rather than learning to code in it.
3. Talk to peers. Listen when they tell that your idea is stupid. Listen to why it's stupid, re-assess, because it most probably is stupid in this case.
4. Give yourself a good pep talk every morning, convincing you that the choices you've made starting this project are the right ones and that they'll bring you to success. Because if you started such a project already, the most efficient way to kill it is to doubt your core decisions.
Once it's working badly and with a ton of bugs, you've already succeeded in actually making it work, and then you can tackle the bugs and improvements.
Some dev is going to hate you for creating something horrific, but that horrific thing will work, and it's what will give another developer a maintenance job. Which is FAR, far more than most would get by focusing on quality and features from day 0.9
The sad story of a coders life in india..
So apparently my friends don't understand the basic concept of "enjoying" coding. This comes from a 1st yr undergrad. Everyone here view coding as some subject or some college course that is done just for the sake of grades. When they get free time, they waste it away smoking up at some filthy old building mocking us coders. Sadly I share a room with such idiots. The problem is that coding is something we love, something we do because our hearts yearn for it, because we are addicted. And because of my useless roommates, I'm losing out on my friggin friends. I swear we coders are always looked down upon way too much. We aren't usual nerds, we just don't believe in wasting our time on tinder or Facebook or smoking pot.10
Most satisfying bug I've fixed?
Fixed a n+1 issue with a web service retrieving price information. I initially wrote the service, but it was taken over by a couple of 'world class' monday-morning-quarterbacks.
The "Worst code I've ever seen" ... "I can't believe this crap compiles" types that never met anyone else's code that was any good.
After a few months (yes months) and heavy refactoring, the service still returned price information for a product. Pass the service a list of product numbers, service returns the price, availability, etc, that was it.
After a very proud and boisterous deployment, over the next couple of days the service seemed to get slower and slower. DBAs started to complain that the service was causing unusually high wait times, locks, and CPU spikes causing problems for other applications. The usual finger pointing began which ended up with "If PaperTrail had written the service 'correctly' the first time, we wouldn't be in this mess."
Only mattered that I initially wrote the service and no one seemed to care about the two geniuses that took months changing the code.
The dev manager was able to justify a complete re-write of the service using 'proper development methodologies' including budgeting devs, DBAs, server resources, etc..etc. with a projected year+ completion date.
My 'BS Meter' goes off, so I open up the code, maybe 5 minutes...tada...found it. The corresponding stored procedure accepts a list of product numbers and a price type (1=Retail, 2=Dealer, and so on). If you pass 0, the stored procedure returns all the prices.
Code basically looked like this..
public List<Prices> GetPrices(List<Product> products, int priceTypeId)
foreach (var item in products)
List<int> productIdsParameter = new List<int>();
List<Price> prices = dataProvider.GetPrices(productIdsParameter, 0);
foreach (var price in prices)
if (price.PriceTypeID == priceTypeId)
prices = dataProvider.GetPrices(productIdsParameter, price.PriceTypeID);
* Omitting the other 'WTF?' code to handle the zero price type
I removed the double stored procedure call, updated the method signature to only accept the list of product numbers (which it was before the 'major refactor'), deployed the service to dev (the issue was reproducible in our dev environment) and had the DBA monitor.
The two devs and the manager are grumbling and mocking the changes (they never looked, they assumed I wrote some threading monstrosity) then the DBA walks up..
DBA: "We're good. You hit the database pretty hard and the CPU never moved. Execution plans, locks, all good to go."
<dba starts to walk away>
DevMgr: "No fucking way! Putting that code in a thread wouldn't have fix it"
Me: "Um, I didn't use threads"
Dev1: "You had to. There was no way you made that code run faster without threads"
Dev2: "It runs fine in dev, but there is no way that level of threading will work in production with thousands of requests. I've got unit tests that prove our design is perfect."
Me: "I looked at what the code was doing and removed what it shouldn't be doing. That's it."
DBA: "If the database is happy with the changes, I'm happy. Good job. Get that service deployed tomorrow and lets move on"
Me: "You'll remove the recommendation for a complete re-write of the service?"
DevMgr: "Hell no! The re-write moves forward. This, whatever you did, changes nothing."
DBA: "Hell yes it does!! I've got too much on my plate already to play babysitter with you assholes. I'm done and no one on my team will waste any more time on this. Am I clear?"
Seeing the dev manager face turn red and the other two devs look completely dumbfounded was the most satisfying bug I've fixed.5
HOW TO KILL A DEVELOPER
Coworker: Hey, is http://website down for you?
Me: yeah. What's up?
Coworker: Ah, that explains why my tests are failing.
Me, internally fuming: It would be good test practice to not depend directly on external services.
Coworker: I know, but this is easier.
This makes my blood boil. I'm not a huge fan of mocking and stubbing everything, but when it's actually very easy to mock something and you're too lazy, that makes me fucking angry.
Remember kids: doing it right takes longer than doing it wrong. But doing it wrong will eventually take significantly more of your time. Just wait until your shitty assumptions fail and you don't have any recourse.6
I'm extremely lucky I'm not violent person. What happened today for some reason just completely pissed me off. I'm not sure why it got under my skin so much, but I feel completely disrespected.
I went to our marketing person's office to discuss a basic requirement for our api. Very simply, we have a lot of old shitty date that doesn't have a lot of fields filled out (worse yet, some are simply bogus values like crazy random dates and whatnot).
She put in a ticket claiming our most recent change started changed the creation dates to be empty. Easy enough to disprove, because the marketing software we have shows a records of all the edits for each contact, and if it came from our api it'll be labeled as "Web API". So of course I check the example contacts she give us, and there's no history of changes, meaning they never had the date to begin with (which is correct, as until now we didn't track creation date WHICH IS NOT MY DECISION. So dude 10 years ago probably made that decision).
So I start asking what exactly we're using it for. She does an absolutely horrible job of describing it and keeps telling me "no you absolutely have to be able to do all this, it's our requirements". By "this" she wants me to magically give all these contacts correct creation dates after the fact.
Eventually she gets the whole campaign idea out and I point, politely, that they're probably violating GDPR. She starts yelling saying her and her boss have been doing marketing for years and they know what they're doing. So I (less politely this time) said that's fine, I just want to talk with her boss to make sure he understands he's in the grey area and that if I'm the one building this, I'm kind of liable as well.
She clearly didn't like that, but I thought whatever, let's just agree on some requirements and I'll pass it on to my boss (who genuinely shits on her every single day and is constantly saying she never knows what she's doing).
So I go back , do some work. A little later I have to go print something off which is next to her office. Her door is shut, but I can hear her from down the hall yelling at someone about the conversation we just had. She actually starts mocking me. Doing the "stupid person" voice. This goes on for longer than our conversation.
Like I said, I know I'm right and she's just venting because she doesn't want to admit she's made a mistake. But for some reason it just completely broke me. I'm new but up until this point everyone had been pretty open about how they feel about me and my co-worker. But she just didn't need to go that bloody far.14
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.12
"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.
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.)8
I'm staring into my empty coffee mug,
hoping I could find this annoying bug.
Like always I have no such luck,
so I'm turning to my rubber duck.
He's emotionless expression I cannot read,
Guess he doesn't have what I need...
I can feel the bug mocking my face,
While I'm aimlessly looking into space.2
Mocking hardcoded data in frozen constants in Rails is such a fucking pain! Why must this be so difficult!?
My deparment manager said to me that I'm the first person he encountered that has a fetish for writing documentation.
In the context of the conversation I felt he was mocking me, that he doesn't understand why its important, and I why feel obligated to do it (everything was a mess when I joined the team 2 years ago).3
I'm getting really tired of those dumbass programmers that do not understand shit and then come to me when production breaks. (I am also a programmer, not really a DevOps engineer, but I'm the least worst at DevOps stuff, so it's my job...).
We're programming some kind of document management tool. Today we had a release, and one of the new features is to download all of your documents as a zip file, which is asynchronuously generated. When it's done, the user gets a mail with the download link to the zip file.
The feature works basically, but today it broke our production service, as somebody was running a test of it.
Turns out all the documents are loaded into memory to be zipped. So if you have 2 gigs of documents, a container with memory restrictions in that area will crash.
I asked the programmer who reported this «ops problem» to me, why he didn't just shit the files into a temp foler in order to zip them in there.
He told me that he wanted to do so, but did not know how to mock this for a unit test, and therefore went to the in-memory «solution», which was easier for him to mock.
For fuck's sake, unit tests and mocks are fucking tools, not ends in itself! I don't give a fuck about your pointless mocking code when the application crashes!
When I got to deal with such dumbasses, I'd prefer to mock those motherfuckers with a leaky bucket of liquid shit, which basically accomplishes the same task from my perspective: dripping shit all over the place and make everything suck as fuck.3
It’s late, and stupid RSpec has decided to only mock calls to a particular method in some specs but not in others.
Works in a few specs, but not the rest. Why? Who the fuck knows. Probably some shared state between specs that isn’t supposed to happen.
HAHA JUST KIDDING
After refactoring my specs to use unique ‘resource’ names for each call because I’ve had shared state issues before.
and after refactoring my model code to remove a lot of now-unused dependency injection (because maybe it was mocking a different object than got passed in?)
When creating my mock objects, I forgot to link them together. That’s it. A 14-character change. And suddenly they all pass.
Time for bed.3
what kind of dumb fuck you have to be to get the react js dev job in company that has agile processes if you hate the JS all the way along with refusing to invest your time to learn about shit you are supposed to do and let's add total lack of understanding how things work, specifically giving zero fucks about agile and mocking it on every occasion and asking stupid questions that are answered in first 5 minutes of reading any blog post about intro to agile processes? Is it to annoy the shit out of others?
On top of that trying to reinvent the wheels for every friggin task with some totally unrelated tech or stack that is not used in the company you work for?
and solution is always half-assed and I always find flaw in it by just looking at it as there are tons of battle-tested solutions or patterns that are better by 100 miles regarding ease of use, security and optimization.
classic php/mysql backend issues - "ooh, the java has garbage collector" - i don't give a fuck about java at this company, give me friggin php solution - 'ooh, that issue in python/haskel/C#/LUA/basically any other prog language is resolved totally different and it looks better!' - well it seems that he knows everything besides php!
Yeah we will change all the fucking tech we use in this huge ass app because your inability to learn to focus on the friggin problem in the friggin language you got the job for.
Guy works with react, asked about thoughts on react - 'i hope it cease to exists along with whole JS ecosystem as soon as possible, because JS is weird'. Great, why did you fucking applied for the job in the first place if it pushes all of your wrong buttons!
Fucking rockstar/ninja developers! (and I don't mean on actual 'rockstar' language devs).
Also constantly talks about game development and we are developing web-related suite of apps, so why the fuck did you even applied? why?
I just hate that attitude of mocking everything and everyone along with the 'god complex' without really contributing with any constructive feedback combined with half-assed doing something that someone before him already mastered and on top of that pretending that is on the same level, but mainly acting as at least 2 levels above, alas in reality just produces bolognese that everybody has to clean up later.
When someone gives constructive feedback with lenghty argument why and how that solution is wrong on so many levels, pulls the 'well, i'm still learning that' card.
If I as code monkey can learn something in 2 friggin days including good practices and most of crazy intricacies about that new thing, you as a programmer god should be able to learn it in 2 fucking hours!
Fucking arrogant pricks!8
wow the CIA guys had the Linux guys in mind as well,
tell me, pros, how would you protect yourself (I'm not mocking, genuinely interested in the defense techniques)10
Cocktail for disaster:
- Averagely well written, testable code
- All tests pass
- One test methods still shows some vague stacktrace in a worker thread ❌ but the test passes ✅
- Run only that test method and no stacktrace.
So I've been pulling my hair for the last two days trying to figure out what was throwing in that test method. Turns out that thanks to the multithreading going on, some other, similar method threw the exception in parallel. And apparently a different test method was already running when the exception was finally caught.
When I discovered that, it was fixed in a minute. 😭1
The way I was told to write unit tests was particularly terrible.
No mocking of objects or dependencies so the tests ran the actual code in full including updating databases and files. Then at the end of each test there was code to restore all changes back to before the test.
Each test ended up being over 100 lines. Madness.1
I recently have been delegated the responsibility of managing a 4 people team by planning the sprints, scheduling tasks, and in general "take charge" (as said by the boss).
What bothers me is there is this "developer" with a heavily toxic attitude, who feels he is above all laws and knows everything just because he joined some months ago all of us.
He is basically a human linter. When he code reviews, you can get away with any major mistake if your linting and indentation (and all that shit) is according to "his standards".
A new guy recently joined the team and was given an overwhelming task by the boss just to test whether he belongs here. (Again, wrong, in my opinion). He didn't know any of the technologies he needs to work on to complete that task but he still learnt them and got a working product. Albeit not according to our God's "standards".
Cut to the chase, the asshole dev is now mocking him in PR comments and demeaning him in every discussion. As a "team lead", what should I do? If I let it go, it'll make the environment toxic and I don't want him to get away with it. If I do take any action, I don't want to be seen as as pussy who can't take such minor insults. Please advise.
PS. The asshole developer once wrote a "friend request accept" API endpoint in such a way that when any single person accepts a request, that'll cause all pending requests (from any person to any person) get accepted. Fucked up the DB queries basically. This is just to give a perspective on what I'm dealing with here.4
I have to install windows for this project because I usually work in spare half hours and the virtual machine takes 15 minutes to boot.
I tried to Google what to do if my only windows machine has space on the secondary disk only, because the install media creator requires 8 gigabytes. The only answers were mocking the op for buying a 50 GB SSD. I didn't even start working and I already hate the windows community.4
What did it tell me to???
Well, I was switching keyboards and started my desktop before i connected the new one. In my mind I was mocking the Mac. Now if I had a Mac it would not let me boot, stupid thing! Luckily I'm running Linux.
Butt wait! Never got that far! AMERICAN MEGANITWITS, if you ask me!8
Had a tech interview earlier today.
👨💻: What mocking framework do you use the most?
🧔: Smoking framework???
I guess either he needs to improve his skills or I have to polish my English 😂6
Right now. It's happening. I'm sitting on one of those seemingly impossible issues. I'm reading the exception and can't fathom how it can be true. I mean, the evidence is right there! The error message must be wrong! But that's the thing, it never is. It's always something stupid and obvious. After you figure it out, you shake your head and laugh at yourself for not seeing it. It's all shits and giggles after you figure it out, but that's not where I'm at right now. Right now I'm being laughed at by this stack trace. It's mocking me even!
Jokes on you though, because I'm coming for you!!2
I am part of a Slack group with dev friends all a lot better than I am. So I write my problem there. After they're done (playfully) mocking me, I am so frustrated that I usually find a perfectly obvious solution when I look back at my thing.
Or I use them as digital rubber humans.1
I feel really dumb for not understanding this but somehow my brain refuses to make sense of it. Using mocks in unit tests that read like this:
Mock: 1 + 1 = 3
Assert: Is 1 + 1 equals to 3?
Or when testing an API and mocking the response to "something" and then testing if it returns "something". I don't get it. I just don't. What did you test? Your typing skills? Your sanity? When does it fail? How is it a test when even if I intentionally break the actual code you are writing the tests for, it still returns "successful" because you kind of programmed it that way?
Call me an idiot but I've been reading about this for a long time now. I see examples online where mocking makes sense and it actually helps test the code but this kind of writing doesn't make sense to me. Some enlightenment would be appreciated.6
Finally made my node production server stable enough that I could focus on writing tests*. I start by setting up docker, mocking cognito, preparing the database and everything. Reading up on Node test suites and following a short tut to set up my first unit test. Didn't go smoothly, but it's local and there are no deadlines so who cares. 4 days later, first assert.equal(1+1, 2) passes and I'm happy.
I start writing all sorts of tests, installing everything required into "devDependancies," and getting the joy of having some tests pass on first try with all asserts set up, feels good!
I decide to make a small update to production, so I add a test, run and see it fail, implement the feature, re-run and, it passes!
I push the feature to develop, test it, and it works as intended. Merge that to master and subsequently to one of my ec2 production servers**, and lo and behold, production server is on a bootloop claiming it "Cannot find module `graphql`". But how? I didn't change any production dependencies, and my package lock json is committed so wth?
I google the issue, but can't find anything relevant. The only thing that I could guess was that some dependencies (including graphql) were referenced*** in both, prod and dev, and were omitted when installed on a prod NODE_ENV, but googling that specific issue yielded no results, and I would have thought npm would be clever enough to see that and would always install those dependencies (spoiler: it didn't for me).
With reduced production capacity (having one server down) I decided to npm uninstall all dev dependencies anyway and see what happens. Aaaaand it works.....
So now I have a working production server, but broken local tests, and I'm not sure why npm is behaving like this...
* Yes I see the irony.
** No staging because $$$, also this is a personal project.
*** I am not directly referencing the same thing twice, it's probably a subdependency somewhere.2
I code. I'm not a network or security admin. Did you even read my resume before hiring me? It says "math degree then data analysis then programming degree" Subnets, firewalls and security certs are not my areas of expertise. Given enough time, could I stumble through? Probably. But I'd probably come up with something worthy of mocking on networkadminrant.
We were having a project followup and a colleague starts boasting to the client about her perfect school grades, so a friend, our tech lead and I start sending messages mocking her, so the tech leads bursted laughing in the middle of the meeting, then the pm asked him what was going on and he rated us out, since then he never uses his cellphone again during meetings.
PM: *mocking me if I'll JUST wait for feedback*
Me: *thinking* I can't produce everything from an INCOMPLETE DB schema and incomplete App Scribble, can I?2
Just spent 3 fucking hours trying to find out why my tests are failing. I'm mocking ef with an in memory sqlite dB as THE FUCKING. Net docs say to.
My code does a simple decimal comparison in a linq statement and returns bullshit. Why? Sqlite does not have a decimal type, it does some sort of BULLSHIT to convert it into some sort of text value.
I change all my models to use doubles instead of decimals and all my tests turn green.
WTF IS THIS SHIT. If it doesn't work don't tell me to use it. I expect better of the. Net docs. Wtf are they doing.3
Spent 1-2h (or it felt like so) fixing this one bug today. I'm still mad about it LoL. I knew exactly what was the problem, just didn't know where it was, and went over that piece of code time and time again and didn't see it... UGH THE FRUSTRATION. When I found the error I wanted to get inside a hole and die of how stupid a mistake it was and how it had been staring at me in the face, mocking me for being so dumb. ARGH!4
AWS and serverless is the future right?
Lambda functions are easy right?
I mean yeah it sounds easy enough to deploy a function and see it run wow, magic, but then in reality you need a lot of stuff:
Maybe 3rd party libraries
AWS configuration hell
Terraform or some shit to make it work
Integrate with other AWS services
Documentation sucks, mocking aws services locally also sucks, you have to write a billion different configuration before you can even begin to implement code.
Fuck my life4
Fuck Swift. Such a garbage language. The last 3 days I tried multiple web server implemented in Swift for mocking API's and none of them worked. Old, not maintained, wrong documentation, wrong code examples and just low quality shit.
Finally I decided to not give a crap and move to use Wiremock and it works out of the box, start and configuration is a breeze and it just plainly works. I should have done that from the beginning.
Btw., as a warning these were the frameworks I used and you should avoid them if possible: Swifter, Embassy, Ambassador and Succulent.1
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?
So today was my first time combining mocking, depenancy injection and promises. I thought I had a relatively good understanding of everything until I started writing tests - now my head is spinning.
The actual coding has gone really well - implimented the strategy pattern so I can reuse my code whenever I want to make an API call - and everything is nicely decoupled so it should be easy to test. In theory.
If anyone here happens to write tests for a living, I have a new found respect for you today...
Time for a beer 😅3
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?
With my work putting more and more things on my plate that I don't want to work on and refusing to increase my pay proportionately I'm thinking about going freelance. My biggest argument against is this that I'm terrible with design.
What design tools to you guys use for mocking up a website? I use Windows and Linux for my work so Mac only apps aren't going to help.
I also struggle with colors. I've never been officially diagnosed as color blind, but I've been told I'm wrong about colors enough to know there's something going on there. Are there any good tools out there that can help select colors that go well together? I'm thinking if a company has a red they use for everything, I put that in and the tool gives me a few color pallettes to work with.
I've also thought about just finding a designer to work with, but then I have to budget for this person as well which means I'd have to take on even more clients. I want to improve my design abilities so I can do more myself.
Any help appreciated guys.2
Somehow mocking xhr requests (?) for Axios is really hard to make it work. I use React Cosmos as I'm re-doing the frontend of this already running in production and works great, but when my component communicates with the backend it breaks and I'm unable to test the full behavior.
Then, it occurred to me that trying to mock Axios may not be the best. So I came with this scheme where I would have a configuration variable with a default value and change that when I need to work with React Cosmos, which in turn changes the behavior of `/auth` to return a valid JWT in response to a GET, put an Axios interceptor in my outermost Cosmos decorator and BAM! suddenly was able to develop and test my React components closer to how they would work in production.
It surprises me how simple this endeavor was, and because everything runs orchestrated by docker compose things run smoother.
(this is not an excuse to not to learn how to deal with the mocking issues of Axios, after all I wont have a working backend every time I work in some frontend application)5
Any opinions on mock tests how deep should you mock logic of a single component?
I am convinced that you only should shallow mock your components.
However there seems to be some component structures out there that require much deeper mocking3
Spent the day migrating to a different mocking framework for our unit tests.
Still a few hours of work to do until they'll all compile.
After that, who knows what'll still need fixing.
Pouring myself a tall one.
So on my new position I get to work on Spark jobs. Never had to work with the infamous big data technologies. I never thought this would get SO frustrating for all the wrong reasons.
I'm currently trying to introduce integration tests for some Spark job I wrote. This isn't trivial though, as the data comes from several HBase tables. Mocking everything simply isn't feasible. So why not use the integrated HBaseTestingUtility? With it you can start a mini cluster that runs all nessecary services in the scope of your test.
Sounds great, eh? WRONG. Firstly the used mapr dependencies get in the way. The baked in configuration tries to automatically authenticate with your local cluster through Kerberos. Of course this doesn't work. And of course there is no way to reconfigure this as it happens IN A FUCKING STATIC BLOCK. AHHHH.
Ok. So after calming down I "simply" had to exclude all mapr dependencies and replace them with vanilla ones. After two days of dependency hell it FINALLY works!
...or does it? Well now we need test data. For that we got a map reduce algorithm that can import dumps. Sounds again, great, eh? WROOOONNNG.
The fucking map reduce mini cluster can't start, as it tries to write a symlink. Now take a wild guess what the sys admin here blocked. Yepp. TWO DAYS OF WORK RENDERED USELESS, BECAUSE OF SOME FUCKING SECURITY SETTING.
This is fine.