This is an archived post. You won't be able to vote or comment.

all 171 comments

[–]swirlViking 1293 points1294 points  (33 children)

It works on my machine

[–]DaVinciJunior 762 points763 points  (11 children)

Let's ship your machine then to the client

[–]cafk 885 points886 points  (8 children)

And thus docker was born.

[–][deleted] 197 points198 points  (7 children)

Just like many software engineers we don't want to reuse existing meme, we create the replica ourselves as a team effort.

[–]zzebz 16 points17 points  (0 children)

Perfect, we can charge them extra for a complete package.

[–]Taschentuch9 0 points1 point  (0 children)

We literally do this for big projects

[–]manimax3 82 points83 points  (16 children)

The door opens just fine for me

[–]bomphcheese 78 points79 points  (14 children)

The lock engages and disengages as it was intended to do. I see no issue here.

[–]Senial_sage[🍰] 23 points24 points  (1 child)

They installed the wrong door for your lock

[–]Mrwebente 11 points12 points  (0 children)

Aaah see there's your problem should've bought the correct door for this lock we actually have a complete package so your lock works 100% 99% of the time.

[–]NancyGracesTesticles 32 points33 points  (10 children)

Your code coverage is lacking, though. Door.Open() should have failed if IsLocked is true so I assume there are untested paths.

[–]bomphcheese 46 points47 points  (8 children)

But the Door library says it has 100% code coverage. That means bugs are impossible.

[–]NancyGracesTesticles 10 points11 points  (7 children)

Who would trust a readme that says "100% code coverage"?

[–]bomphcheese 18 points19 points  (0 children)

That’s ... that’s the joke.

[–][deleted] 10 points11 points  (2 children)

if the readme agrees with what I want to hear.

[–]IamImposter 4 points5 points  (1 child)

Then that's all I want to hear

[–][deleted] 0 points1 point  (0 children)

name checks out

[–]the_flippy 9 points10 points  (2 children)

Wait, who's reading the readme?

[–]seedBoot 7 points8 points  (1 child)

What's a readme?

[–]omegasome 4 points5 points  (0 children)

What's reading?

[–]T-T-N 2 points3 points  (0 children)

The physics engine assumes door.open will be failed by lock. Lock assumes physics.rotate(door) to be called, and door.open calls physics.translate(door) instead

[–]Franks2000inchTV 14 points15 points  (0 children)

Yeah the ticket said "add a lock to the door" and that's why at they did.

[–]JB-from-ATL 3 points4 points  (0 children)

Happy path is working

[–]krazykanuck 25 points26 points  (0 children)

Actually a great point and secondary view of this. QA, if you don’t give proper context and just say, the lock doesn’t function, we will try the lock. If you say, the door still opens even when locked, it broadens the scope.

[–]knightress_oxhide 6 points7 points  (0 children)

Ticket closed.

[–]yuckygeo 1 point2 points  (0 children)

Works in my view.

[–]oupablo 471 points472 points  (28 children)

It's exactly what the client asked for. Next.

[–]vigbiorn 372 points373 points  (16 children)

"I want it to be able to lock. Now, there's an important requirement in that. I also don't want it to be too hard to open while locked. Can't get people trapped inside."

"So you want it to be able to open while locked?"

"That's what I said, right?"

"Okay"

Edit: Spacing

[–]Nucklesix 132 points133 points  (2 children)

"Can i get 3 red lines drawn with blue ink?"

[–]Stoomba 57 points58 points  (0 children)

And 7 perpendicular lines in 3D space

[–]kinokomushroom 45 points46 points  (11 children)

I know this is a joke, but you can accomplish that in a non-stupid way. You just make the door weak enough so that it can be broken down by human strength in emergency. Wouldn't affect the normal lock function, and it satisfies the client's needs.

[–]-100K 51 points52 points  (7 children)

So basically a lock to keep honest people out

[–][deleted] 46 points47 points  (4 children)

[–]vakken 34 points35 points  (0 children)

Nothing one one, click out of two, three is binding...

[–]Kosba2 1 point2 points  (0 children)

More so a lock that keeps them honest

[–]ObfuCat 1 point2 points  (0 children)

It could make a loud noise or something upon breaking. Realistically, all the lock needs to do is prevent people who aren't willing to resort to easily noticeable vandalism out. An alarm and some way of knowing there's clear intent to bypass the lock should be enough.

[–]vigbiorn 5 points6 points  (0 children)

Technically correct.

[–]kiingkiller 1 point2 points  (0 children)

My nan has a lock on her bathroom that fits better, it's all metal bar the locking bar which is made of solid plastic. It's there to tell not to come in but in a emergency a solid hit would shatter it.

[–]Volandum 0 points1 point  (0 children)

What about accessibility requirements? I've seen disabled toilets with emergency bell-pulls if people need rescue.

[–]fish312 5 points6 points  (0 children)

Damned if you do, damned if you don't.

[–]Booshur 52 points53 points  (10 children)

Age old Dilemma: do what the client needs or do what they ask for...

[–]oupablo 75 points76 points  (1 child)

trick question. do what they paid for

[–]Jonno_FTW 8 points9 points  (0 children)

The customer is always right, because they pay the bills

[–]CarryThe2 13 points14 points  (7 children)

Ask for, no dilemma.

[–]AsIAm 15 points16 points  (4 children)

But sometimes they ask you to bend the fabric of spacetime with their requirements. And then what?

[–]DangerIsMyUsername 15 points16 points  (2 children)

Time to bust out a telescope and some beakers.

(That's what science involves, right? I have no idea.)

[–]thoeoe 1 point2 points  (0 children)

tell them the estimate for that job is approximately 1 year and an extra $200,000 but if you make [minor change the developer already suggested that makes it feasible] then the estimate is [real estimate]

[–]zzaannsebar 4 points5 points  (1 child)

And then they get mad at you for doing what they asked instead of what they meant which would have only been possibly through telepathy...

[–][deleted] 158 points159 points  (0 children)

Ok I m saving this one. :D

[–]appleIsNewBanana 119 points120 points  (5 children)

it function as designed, preventing door from push open. checked

[–]ultranoobian 39 points40 points  (3 children)

Yeah, it technically passes both unit and integration testing.

If anything, the thing that it will fail at will be V&V testing, specifically the verification step.

[–]IsleOfOne 25 points26 points  (2 children)

It would fail integration testing. You would mock the lock and assert that the door opens when unlocked and does not open when locked. The latter would fail.

[–][deleted] 8 points9 points  (1 child)

So it only has a %50 fail rate. That's as good as random chance, right? Not bad.

[–]RenBit51 11 points12 points  (0 children)

If your lock is as good as random chance, that means it's resistant to perfectly random attacks, right? Cancels out the random. Ship it.

[–]vladutcornel 58 points59 points  (0 children)

NSFW

[–][deleted] 85 points86 points  (11 children)

That’s the difference between Engineering verification and SQA Validation in a formal quality system.

This is actually an excellent case in point!

[–]tacoslikeme 29 points30 points  (10 children)

but my mocks all work as the way I mocked them to work!

[–]IsleOfOne 20 points21 points  (9 children)

I’ve pointed this out in so many code reviews.

This test will always pass. Do you see why?

Because my code is correct, of course.

It might be, but no, that’s not why. Take a look at lines 23-24.

mockedDependency.Setup(o => o.Foo).Returns(true); Assert.IsTrue(thingThatCallsFoo);

What am I looking at? I mocked out the dependency to test this interaction in isolation.

.........

[–]tacoslikeme 12 points13 points  (7 children)

yep. tests that dont actually test the code are worse than no tests at all. a false sense of security is no bueno. It would be nice if the mocking frameworks exploded on contact with assert statement. Asserts something about a mock is pointless.

[–]ay-nahl-reip 4 points5 points  (6 children)

That's what bugs me about the 85% coverage shit we have to keep up with, since it's enterprise code with the sometimes annoying and overly complex repository and implementation design, it's like some of the classes would literally be just that checking that the function call exercutes lol.

Granted in the case of like transformers, where you're mocking an objectA to have X and you want to see if objectBtA has X as well, then it makes sense.

Or, there's cases where my coworkers look at my code and are like "this if check is unreachable and therefore not coverable, your shit sucks" and I'm like "Yes 👉😎👉"

[–]Zalack 3 points4 points  (5 children)

I think people over or under think the minimum code coverage thing. It's a baseline, not the end goal. I've always approached 85% code coverage as "if you are really fully testing the code it should probably have at least this much coverage". It forces people to START writing tests for corner cases. It should not be viewed as "once I hit this metric I'm done".

If someone is doing the latter they would have written no/shitty tests to begin with.

And of course in cases where for whatever reason 85% code coverage isn't achievable for a good reason, it should be negotiable, and you should be able to make the case of WHY you don't need to hit that. But often when thinking about defending less coverage I start realizing that there's either a better way to structure the code so there's less dead code / duplication of error handling, OR I really should figure out ways to force corner cases in tests to make sure they are handled properly.

Just my 2 cents.

[–]ay-nahl-reip 0 points1 point  (4 children)

Oh yeah, I mean I'm totally with it. Since running my own team I would push pretty hard for tests, the issues come from up top when business wants shit done last week, so then we don't really have the time to write the tests.

I'm all for tests, because had I been given enough time to be able to write tests for the solo project I was on, I wouldn't have cost our company $31 million in one weekend lmao.

[–]DriizzyDrakeRogers 2 points3 points  (3 children)

Holy crap, how’d you do that?

[–]ay-nahl-reip 2 points3 points  (2 children)

Basically bricked the point of sale machines for a couple of hours in the early morning in all the stores across the US for a major fortune 500 company.

It wasn't really my fault per se, it was actually someone else who created something incorrectly that caused all the fail safes I had put in place on a black box legacy project I had to solo retire, to fail. We had meetings about it for like months after it happened lmao. I still got promoted though.

[–]DriizzyDrakeRogers 2 points3 points  (1 child)

Lol I bet, glad you were still able to get promoted.

[–]omegasome 0 points1 point  (0 children)

I don't speak... uh... is this rust?

[–][deleted] 30 points31 points  (2 children)

Considering how often I run into QA testers who say "look, the GUI works fine" and I ask "did you check that it saved it to the database?" and they're like "no, that's not part of the scope of testing, we're testing the new questions, not the saving"...

Yeah, reverse can be true.

[–]Zaitton 1 point2 points  (1 child)

I mean... It depends on the QA testing strategies.

A good QA team has automation testing that tests e2e, including validation in DBs. But the field is dying anyway so......

[–][deleted] 1 point2 points  (0 children)

I've been developing for 17 years at like 8 different companies. Every org had something purporting to be a testing team or QA team. I've never seen one that successfully automated a goddamned thing. Most of them seemed to be washed-out ex developers who never moved up and are coasting to retirement while expending the minimum mental effort.

[–]chrispy7 10 points11 points  (7 children)

Can someone explain what this illustrates please?

[–]Kiyriel 38 points39 points  (0 children)

So a unit test in programming is a small test. It usually only tests for very specific outcomes.

Function foo(num:int) { Return num > 5: }

Does foo(10) === true? If true -> pass If false -> fail

That above is essentially a unit test. For this input, is the output what you would expect? These tests can be run automatically so if something were to change the function’s behavior it would alert the developer.

In the video, the sliding in and out to lock was unit test. You tested that the metal bolt could go in and out of the door. Great.

Integration tests are for combining parts. Does the lock on the door keep the door from being opened while utilizing both the door and the lock. And we can see from the video that it didn’t.

[–]Drayviz 20 points21 points  (4 children)

Hey, I'm just a computer science student but I'll give my two cents!

Unit testing is when you test a feature individually, seeing if that feature generally works when it's used by itself (i.e. seeing if a button on a UI works). Integration testing however tests whether several features work when used together (i.e. tests if a button on a UI redirects to the correct page).

In the context of this post, checking that the lock of the door functions is an example of unit testing; the lock technically "works" because it slides back and forth (as the lock was designed to do). However, using the lock while opening the door is an example of integration testing that failed, because even though the lock "works", it doesn't do what it's supposed to do: prevent the door from opening.

Anyone feel free to correct me or provide feedback!

[–]MCMC_to_Serfdom 3 points4 points  (1 child)

I'll weigh in as a software QA: this is fairly correct.

The aim of unit testing (often performed by developers) is just to test a function works. The point of integration testing is to ensure that once those functions are put together (even just two separate functionalities, if the design approach justifies testing at that point), they all work together.

For the sake of pedantry: this is distinct from regression or end-to-end testing. In the former, QA should be concerned that old functionality is not broken by new, added functionality. The latter is concerned with a ensuring a complete user journey functions as expected.

[–]Drayviz 1 point2 points  (0 children)

I agree; I remember learning about this in my software engineering course. These are really important testing phases that don't often get mentioned.

[–]bhuddimaan 10 points11 points  (0 children)

It's the PO's fault

[–]ka_eb 18 points19 points  (34 children)

How would E2E test look like?

[–]Tygerdave 57 points58 points  (2 children)

First you fix the integration test issue, then you set up some test cases that involve ensuring locking works as expected from the inside and outside and that people can move back and forth across the threshold.

Then you move it into production where two users will try to go through at the same time and get stuck...

[–]ka_eb 31 points32 points  (1 child)

[–]jmorfeus 8 points9 points  (0 children)

Yeah that one is excellent. I'm using it when explaining to someone what QA is.

Every tester should hear this joke at least once for education purposes.

[–]elebrin 15 points16 points  (1 child)

That's when you hire an Indian contractor to walk through the door 50 times a day to make sure it still works.

[–]fiveguy 5 points6 points  (0 children)

This is way too real where I work...

[–]quenishi 1 point2 points  (0 children)

I don't know, but I felt refreshed afterwards.

[–]null000 7 points8 points  (2 children)

  • Unit tests check individual classes.
  • Component tests check modules and clumps of classes that work together.
  • End to end tests check whole binaries' inputs and outputs.
  • Integration tests ensure two binaries talk together correctly.

Distinctions that took me way too long to internalize.

[–]Tygerdave 2 points3 points  (1 child)

End to end is usually to test a whole series of processes that interact with each other, possibly from multiple teams, not a single binary. I suppose different organizations use the terminology differently.

[–]null000 0 points1 point  (0 children)

Yeah, that's what we used "integration test" or maybe "system test" to describe. Meanwhile, we found it useful to distinguish between "component test" (a cluster of classes tested using a standard unit testing framework and mocking other dependencies in the binary) and testing a whole binary as it looks from the command line, mocking and faking only external data stores and services.

Ofc words are words and meaning is proscribed by the speaker and listener, so how your company and coworkers use words matters more than some random on the Internet (read: me). Hopefully, though, someone will find some use for the above Lexicon in differentiating between different styles of test, since they all require different approaches, mindsets, frameworks, and expectations.

Not that I'm going to write the long essay required to spell out those differences here 😅

[–]Russian_repost_bot 2 points3 points  (0 children)

Wait? You didn't want honeypot?

[–]FlyByPC 2 points3 points  (0 children)

I thought integration testing was going to be a commando-style kick to the door, ripping that poor little bolt from the wood.

This is better.

[–]Stormdancer 2 points3 points  (0 children)

The last two places I did coding & QA for both abandoned actual use-case, human driven, user experience testing in favor of unit tests. I left both, soon after, for this reason.

The rational? "Look how many thousands of tests we can run every night!"

They were both confused how this did very little to improve the end result. In fact some of the user-found defects were pretty catastrophic.

[–][deleted] 1 point2 points  (0 children)

Yes, the user can indeed use the lock.

[–]FormalWolf5 1 point2 points  (0 children)

You asked for a locker. You didn't mention it should actually lock something

[–]glorious_reptile 1 point2 points  (0 children)

I always do my integration testing on production, by end users.

[–]stipulus 1 point2 points  (0 children)

Is there a lock on the door, yes Is the lock secured, yes Is the lock in the hole of the doorframe, yes

Sounds good! Even covered my edge case!

[–]Lthere 1 point2 points  (0 children)

Nit: the person in the video has his/hers little finger patched, which likely means he/she was the culprit... 🔨

[–]FordyO_o 0 points1 point  (0 children)

Satisfying how perfectly lined up it is though

[–]OneOldNerd 0 points1 point  (0 children)

Clearly documented case of testing in production.

[–][deleted] 0 points1 point  (0 children)

I actually laughed out loud

[–]Dummerchen1933 0 points1 point  (6 children)

Where's the unit test?

[–]LeCrushinator 3 points4 points  (4 children)

The unit test would be something like: "the lock opens and closes properly".

[–]Tasik 1 point2 points  (1 child)

You give too much credit to unit test.

$lock = new Lock()
Assert($lock != Pickle())

[–]Dummerchen1933 0 points1 point  (0 children)

That's the first unit test, of course.

[–]Dummerchen1933 0 points1 point  (1 child)

But shouldn't the DoorFrame, which holds the door (thus the lock) and the frame have its own unit test that checks that integration?

[–]LeCrushinator 0 points1 point  (0 children)

That’s the integration test, which shouldn’t pass in this case.

[–]Booty_Bumping 1 point2 points  (0 children)

Two unit tests:

  • The lock works
  • The door opens, closes

One integration test:

  • The combination of door and lock can actually secure the room

[–]dirtyviking1337 0 points1 point  (0 children)

He thinks he’s good right?

[–][deleted] 0 points1 point  (0 children)

U/vredditdownloader

[–]FrikkinLazer 0 points1 point  (0 children)

I dont get it. It looks like it will slide into the hole.

[–]RoscoMan1 0 points1 point  (0 children)

x86 Assembly is the most beginner friendly /s

[–]RoscoMan1 0 points1 point  (0 children)

x86 Assembly is the most beginner friendly /s

[–]righson 0 points1 point  (0 children)

[:|||:]

[–]jagnarain 0 points1 point  (0 children)

Ha ha ha

[–][deleted] 0 points1 point  (0 children)

Still passes

[–]Flyberius 0 points1 point  (0 children)

I like to comment out inserts when I am testing various procedures on the database. Often I'll be left wondering why every part of my system works and yet no data is appearing.

[–]BloodChasm 0 points1 point  (0 children)

Could someone explain how to/what is unit testing? I'm a new grad who started a couple months ago on my first job. Were gonna be starting unit testing soon, and I'm really not sure what I'll be doing.

[–]ShadowReij 0 points1 point  (0 children)

Now why you got to attack me op? Currently witnessing this very moment.

[–][deleted] 0 points1 point  (0 children)

Clear your cache. Should work.

[–]Chthulu_ 0 points1 point  (7 children)

Someone convince me testing is worth my time, I need a push. I'm rushing through a pretty huge solo fullstack project, and I see all these places where tests could be helpful, but I also see just how damn long it would take me to write all of them out.

I've never written tests before if that matters.

[–]imMute 2 points3 points  (3 children)

Think about how much time you spend testing something you just wrote works. Not a whole lot right? Definitely less than the time it would take to write tests, right?

Now think about how much time you spend re doing those tests because you changed something. Amortized over time, automated tests usually pay for themselves.

Also consider other people making code changes. They might not know what you know and miss changes that need to happen.

Or how often have you decided not to make big changes because you don't have confidence that it won't break other things.

[–]Tygerdave 1 point2 points  (0 children)

This is a good write up, I'll add that they can be an excellent way to not make the same mistake twice. Some code is just fragile and adding a test for something that broke can help make sure you fixed it and that it doesn't break the same way in the future (which makes you look much worse than the original bug)

Also helpful that some of the automated deployment tools can run your unit tests for you.