The Tests Need to Pass



  • I've been working in the background on creating lots of JUnit tests for our applications. Mind you, I'm not testing one line getter/setter methods; I'm testing the meat of the application here, and working my way back toward the secondary code.

    Naturally, every now and then, someone has to work on the code for which there is a test, and in the process, breaks it. When this happens, the build tool dutifully sends an email to the team informing them that the almighty tests have failed, darkness is coming and all good things will come to an end.

    Of course, running the build every 15 minutes makes folks get complacent about these emails, and folks have started to ignore them until they're done with whatever feature they're building.

    Then one day, the emails suddenly stopped. Everyone asked how all the code got fixed and who did it (to thank them).

    It turns out, the guy who is responsible for running the build tools just commented out all the assertXXX calls at the end of every test and committed everything.

    Why? Because the tests need to pass!

     



  • When everything seems hopeless and nothing is working out for you, remember: This Too Shall Pass.



  • Reminds me of a guy at my last job.  I was out on vacation for a week, and he had to write unit tests for my code.  One class was a wrapper around another object (possibly some other stuff).  When you tried to access the object, and it was null, it threw a NPE.  So the unit test tested for that.  Nevermind that it should have simply returned null.



  • Sounds like his direct deposit routing information should be commented out in HR's payroll system.

    Is it routine at your workplace for the unit tests to be written by somebody other than the developer implementing the behavior, or is this a unique situation? Also,why is a build happening every 15 minutes?

     

     



  • @Rootbeer said:

    Sounds like his direct deposit routing information should be commented out in HR's payroll system.

    Is it routine at your workplace for the unit tests to be written by somebody other than the developer implementing the behavior, or is this a unique situation? Also,why is a build happening every 15 minutes?

     

    The unit tests are SUPPOSED to be written by the developers, but never were. As such, we had a fairly complex system with very few tests (>100K LOC and less than 50 tests). We still have about 100K LOC but now have over 2000 tests and counting. It was add them after the fact or live without them.

    The build guy decided that once a day was not good enough so he changed the interval to 15 minutes to give folks more timely warning that whatever they committed as part of a checkpoint didn't build or pass all the tests.

    Yeah!

     



  • It seems like the real problem is, developers want to make frequent check-ins, instead of a monolithic check-in at the end, which causes MAIN to frequently be broken. The solution is to let them work on branches, and don't hassle them about the status of their own branches. You're just responsible when MAIN breaks.



  • @smxlong said:

    ...branches
    I had suggested that and it was flatly turned down because "Branches are too complicated, it's easier if everyone just works in the main trunk." - no amount of reasoning was going to make a difference.



  • @Paddles said:

    When everything seems hopeless and nothing is working out for you, remember: This Too Shall Pass.

    Much like kidney stones.



  • @Rootbeer said:

    Sounds like his direct deposit routing information should be commented out in HR's payroll system.

    +1.  I'm no huge fan of unit tests, but it sounds like this guy has a terminal case of Just Does Not Get It and really does not belong on your team, or anywhere near a compiler for that matter.

     



  • I'd like to know more about what you mean about "no huge fan of unit tests". Please describe your testing strategy.



  •  Must... run ... unittest .. . locally.

     ...

     Must ... pass alll ... test before ... commit.....

    ....

    ....

    </zombie mode>



  • @mk82 said:

    I'd like to know more about what you mean about "no huge fan of unit tests". Please describe your testing strategy.

    I also am not huge fan of unit tests. Here's why:

    1) There are entire classes of bugs unit tests won't, and in fact can't, catch... and IMO these are the most important bugs.

    2) People who are fans of unit tests become delusional and think unit tests can solve every problem everywhere ever, and thus ignore point 1, and thus produce inferior software.

    Much of Microsoft's issues with Vista was due to an over-reliance on automated testing. Sure everything in the OS worked, but there's no unit test that can say "whoa guys, if you start the search indexer and start filling the DLL cache right after first boot, people are going to get a real lousy first-run impression. Reviewers are going to skewer us." And that bug (fixed in Windows 7, probably with under 15 minutes of engineering effort) cost them millions of sales.



  • @blakeyrat said:

    I also am not huge fan of unit tests. Here's why:

    1) There are entire classes of bugs unit tests won't, and in fact can't, catch... and IMO these are the most important bugs.

    2) People who are fans of unit tests become delusional and think unit tests can solve every problem everywhere ever, and thus ignore point 1, and thus produce inferior software.

    Much of Microsoft's issues with Vista was due to an over-reliance on automated testing. Sure everything in the OS worked, but there's no unit test that can say "whoa guys, if you start the search indexer and start filling the DLL cache right after first boot, people are going to get a real lousy first-run impression. Reviewers are going to skewer us." And that bug (fixed in Windows 7, probably with under 15 minutes of engineering effort) cost them millions of sales.

    You make two very valid points with your argument, however let me counter by saying that automatic testing should NEVER be your only line of testing. Just as with security, you have to have multiple layers to ensure proper coverage. I use Unit Testing in my current project as a way to ensure that code changes do not negatively impact other parts of my code. It's also a good source of documentation, in that it demonstrates some possible ways that the code can be used. Additionally, it's helped me uncover several subtle bugs that would have been more difficult to find with simple QA testing. Additionally, you can write Unit Tests when a bug report is filed as a means of reproducing the bug (where applicable), and then use that test in the future to ensure regression testing.



  • @dohpaz42 said:

    You make two very valid points with your argument, however let me counter by saying that automatic testing should NEVER be your only line of testing. Just as with security, you have to have multiple layers to ensure proper coverage.

    Well duh, and yet my point 2 (which you apparently did not read) still applies. If the point 2 people get in charge of the product, as happened at Microsoft, you end up with an inferior product. Obviously this should never happen.

    So the key is to piss all over unit tests every chance you get, to keep those unit testing-obsessed people a nice dose of reality.

    BTW, it's also virtually impossible to unit-test a complex JavaScript/DOM application. I don't even try with mine. I do the old fashioned kind of QA, wild west-style. Yeeeehaw!



  • @blakeyrat said:

    @dohpaz42 said:
    You make two very valid points with your argument, however let me counter by saying that automatic testing should NEVER be your only line of testing. Just as with security, you have to have multiple layers to ensure proper coverage.

    Well duh, and yet my point 2 (which you apparently did not read) still applies. If the point 2 people get in charge of the product, as happened at Microsoft, you end up with an inferior product. Obviously this should never happen.

    Even when someone agrees with you, you just can't help but be an ass. Yes, I obviously read your points. You obviously missed the part where I said, "automatic testing should NEVER be your only line of testing". But then again, you're blakey, and you just can't help yourself.



  • @dohpaz42 said:

    Even when someone agrees with you, you just can't help but be an ass. Yes, I obviously read your points. You obviously missed the part where I said, "automatic testing should NEVER be your only line of testing". But then again, you're blakey, and you just can't help yourself.

    You demonstrably did not read and/or understand point 2. It's great that you agree with me, but next time try first understanding exactly what I typed, then agreeing with me-- and I won't feel compelled to clarify my points, because it won't be necessary.

    In fact, I'd much rather have people read and understand my post, whether or not they agree with me. I'm sick of this whole "skim the first sentence, then reply to something wholly different than was typed" bullshit you see so often on this and every other Internet forum.

    So there, nyah.


  • :belt_onion:

    @blakeyrat said:

    2) People who are fans of unit tests become delusional and think unit tests can solve every problem everywhere ever
    citation needed



  • @blakeyrat said:

    [So there, nyah.

    I totally disagree blakey, dogs are better than cats

    Woof!



  • @blakeyrat said:

    @dohpaz42 said:
    Even when someone agrees with you, you just can't help but be an ass. Yes, I obviously read your points. You obviously missed the part where I said, "automatic testing should NEVER be your only line of testing". But then again, you're blakey, and you just can't help yourself.

    You demonstrably did not read and/or understand point 2. It's great that you agree with me, but next time try first understanding exactly what I typed, then agreeing with me-- and I won't feel compelled to clarify my points, because it won't be necessary.

    In fact, I'd much rather have people read and understand my post, whether or not they agree with me. I'm sick of this whole "skim the first sentence, then reply to something wholly different than was typed" bullshit you see so often on this and every other Internet forum.

    So there, nyah.

    Sigh. Okay, I'll give you this one. I had originally meant to type up how unit testing is used to test certain aspects of code, while other forms of testing should be used to check for things that unit testing cannot reliably test. But unit tests are still a valid aspect of testing, as long as responsibility is taken to ensure that the code base is thoroughly covered (this is the part that was meant to agree with your first point, but using my opinion to expand it). Either it got mangled by CS, or I either edited it out and forgot to put it back in, or I meant to type it up and forgot to because I got distracted (shiny!). Regardless, I can now see why you would respond the way that you did. However, just because I expanded my response with my own personal experiences should not go to mean that I didn't read, digest, and understand your post - it goes to mean that I was contributing an alternate opinion than yours. That last point still makes you an ass for assuming wrong.



  • I think I understood blakey. His point is that someone needs to hate on unit testing so that the point 2) people become aware that their way of testing isn't the holy grail and final solution for everything. So no matter what his actual opinion on the necessity of unit tests is, he'll continue to hate on them to be the one who does it. Therefore, it's pointless to remind him that unit tests have an actual value, because he knows about it, but he can't show, because he's the one who needs to hate on them. Right?

    It's a convoluted kind of logic, but it doesn't make him an ass. Of course he is pissed if you think he's an ass when he just follows his what he thinks is a selfless mission of hating on unit testing to passively help the deluded... this whole theory sounded better before I started typing, honestly...


  • 🚽 Regular

    I'll add to this another big advantage to unit testing: When a tricky edge-case bug in the wild is found, and it's difficult to reproduce in the application because it takes a lot of steps or a very specific configuration, then having an existing test fixture is ideal to fabricate the conditions necessary to reproduce the error, in an isolated environment, so that you can observe exactly which components are responsible for the bug, plus all you have to do is run the test to reproduce instead of manually running the application and going through the step again. By fixing it this way, you now have code that demonstrates this specific bug fix, a sort of "proof" of the bug fix, plus if someone down the road changes something that reintroduces the bug, it's immediately caught by the unit test during the build process.



  • @derula said:

    Of course he is pissed if you think he's an ass when he just follows his what he thinks is a selfless mission of hating on unit testing
     

    Blakey is the best Karkat.


  • ♿ (Parody)

    @blakeyrat said:

    I also am not huge fan of unit tests. Here's why:

    1) There are entire classes of bugs unit tests won't, and in fact can't, catch... and IMO these are the most important bugs.

    Your number one may in fact be correct about which types of bugs are more important (I can only guess based on the content of previous rants), but there are plenty of show stopping bugs that automated testing can catch. I will assent to your favorite bugs being more important as long as we all understand that it's a meaningless distinction. And isn't an argument against automated testing at all. And that's without even getting into the economics of it.

    @blakeyrat said:

    2) People who are fans of unit tests become delusional and think unit tests can solve every problem everywhere ever, and thus ignore point 1, and thus produce inferior software.

    Your number 2 is obviously a straw man, and just makes you look like an idiot, which is why I quoted it.



  • @dhromed said:

    Blakey is the best Karkat.

    I don't know what that is.

    Anyway, if you guys didn't have me to create rant-y topics and insult(?) all the time, there'd never be anything to post in these forums. I'm just doing my part to keep the community alive. (So is Nagesh, BTW, and you guys are all assholes to him and you should stop it, assholes.)



  • What I like about unit tests and TDD is that I don't really need to know anything about programming.  I just keep modifying code until the tests pass.  I like to think of it as a manual genetic algorithm.  Hmmm...Maybe a I could automate my code generation...



  • @blakeyrat said:

    @dhromed said:
    Blakey is the best Karkat.
    I don't know what that is.

    @blakeyrat said:

     

    I'm just doing my part to keep the community alive.

    So say we all

    @blakeyrat said:

     

    you guys are all assholes, keep the good work

    FTFY



  • @serguey123 said:

    http://mspaintadventures.wikia.com/wiki/Karkat_Vantas

    Every sentence of that Wiki sounds like a homeless guy's drunken hallucination after reading TimeCube. WHAT THE FUCK.

    @Crazy Person said:

    After developping plans with Jade, he witnessed Eridan killing Feferi and Kanaya. He attempted to revive Kanaya with a kiss afterwards, which may have contributed to her later vampirism (as he is the Knight of Blood). He was also contacted by Gamzee, who had run out of pies and gone crazy.

    Oh well that makes... what?

    @Crazy Person said:

    In this same conversation, Karkat catches himself thinking of a RATHER ODD IMAGE after watching Jade BEAT THE SHIT OUT OF HER DREAMSELF in a callback to ANOTHER BEATING that ended in SLOPPY MAKEOUTS.. Whether it is because of his typing error or the cause of it, this was not the end of Karkat's FREUDIAN SLIPS. It is worth noting that Nepeta's reconstructed shipping wall portrays Jade as an auspistice for Karkat's past and future selves.

    Yeah, I see how that could... huh?

    @Crazy Person said:

    Karkat's CUSTODIAN is a towering, bipedal crab monster with a taste for chilled roe cubes. It was killed when Karkat's computer exploded as a result of running Sollux Captor's MOBIUS DOUBLE REACHAROUND VIRUS, thereby implementing the curse (if curses are a real thing) that leads to the death of the other trolls' lusus as well. An interesting note is that it died concussively, leaving Karkat's anonymity intact by not bleeding.

    His origin has something to do with the Sufferer's followers, specifically so that Sufferer's second incarnation (Karkat) would have a lusus to raise him.

    Karkat later prototyped his dead lusus into his KERNELSPRITE.

    This all makes perfect sen-- WTF!??!?

    (The most amusing part of that last one is that the image of the CUSTODIAN is not bipedal. I dunno why I find that so funny in a Wiki full of so much insane...)



  • Don't expect anything on MS Paint Adventures to actually make sense, Blakey.  It's easier on your sanity that way.



  • @blakeyrat said:

    (So is Nagesh, BTW, and you guys are all assholes to him and you should stop it, assholes.)
    What's up with Nagesh anyway?  Lately most of his posts have been really weird.  It's like he either had a stroke, is experimenting with drugs or gave his account to someone else who is a really shitty troll.



  • @El_Heffe said:

    What's up with Nagesh anyway?  Lately most of his posts have been really weird.  It's like he either had a stroke, is experimenting with drugs or gave his account to someone else who is a really shitty troll.

     

    Yeah.

     



  • @blakeyrat said:

    Every sentence of that Wiki sounds like a homeless guy's drunken hallucination after reading TimeCube. WHAT THE FUCK.
     

    It's a webcomic with severely over-engineered plot and narrative. Go read it. It's fantastic.

    There's a book in it with the familiar "for Dummies" theme, called "Data Structures for Assholes" and contains an excerpt. again, it's fantastic.

    But maybe you should try Problem Sleuth first.



  • @dhromed said:

    It's a webcomic with severely over-engineered plot and narrative. Go read it. It's fantastic.

    If I want to hear crazy-person, I'll just ride the bus at 2:00 PM.



  • @blakeyrat said:

    If I want to hear crazy-person, I'll just ride the bus at aproximately 2:00 PM.

    FTFY

    Remember those lying asshole from your bus company that lied on your face about the bus schedule?



  • @El_Heffe said:

    @blakeyrat said:

    (So is Nagesh, BTW, and you guys are all assholes to him and you should stop it, assholes.)
    What's up with Nagesh anyway?  Lately most of his posts have been really weird.  It's like he [ ] is a really shitty troll.

    FTFY


  • @blakeyrat said:

    If I want to hear crazy-person, I'll just ride the bus at 2:00 PM.
     

    Yer already twitfollowing me, man. Too late for that.



  • @derula said:

    It's a convoluted kind of logic, but it doesn't make him an ass. Of course he is pissed if you think he's an ass when he just follows his what he thinks is a selfless mission of hating on unit testing to passively help the deluded... this whole theory sounded better before I started typing, honestly...

     

    -1 Needs more rambling



  • @serguey123 said:

    @blakeyrat said:
    @dhromed said:
    Blakey is the best Karkat.
    I don't know what that is.

    God, trwtf is that sort of crap. Seriously, if you are going to put such tripe in posts, please preface them with a disclaimer, like "pls ignore mah stupids link". Thanks in advance!



  • @mahlerrd said:

    God, trwtf is my crap. Seriously, if I'm going to put such tripe in posts, I'll preface them with a disclaimer, like "pls ignore mah stupids post". Thanks in advance!

    FTFY

    He asked what it was, I just linked to the wiki, If you don't like Karkat, fine, but do not take it on me, asshole standard user of this forum



  • Interesting....

    1) Typically we have a new build queued on the main trunk every 20-30 minutes. Not quite the same rep-rate as previously mentioned by not that different. During a normal workday (which is long because of time differences between members) it is not unusually to have over 25 builds per day.

    2) While not all bugs can be caught, we have had very good success (largely because of spcification based design) of having a rock solid policy that before *any* code change is made, an automated test (not necessarily "unit") is created which fails because of the defect [including things like performance issues, slow startup, etc]. This virtually eliminates regression erors, and provides an excellent tracking mechanism for changes over time (from a funcional perspective)



  • @serguey123 said:

    @mahlerrd said:

    God, trwtf is my crap. Seriously, if I'm going to put such tripe in posts, I'll preface them with a disclaimer, like "pls ignore mah stupids post". Thanks in advance!

    FTFY

    He asked what it was, I just linked to the wiki, If you don't like Karkat, fine, but do not take it on me, asshole standard user of this forum

     

    Excellent correction, I will take it into consideration!

    [pls ignore mah stupids post] Sorry Sergeuy123, the rant was directed at Dhromed, and I'm sure it's just an oversight.

    On another note, is that semi-coherent rambling really what you kids read nowadays?


     



  • @mahlerrd said:

    that semi-coherent rambling
     

    You're going to have to be a little more specific. I don't care about the wiki, I don't care that people are insane enough to create and maintain a wiki for a $#! webcomic, but hey you know fandom; whachagonnado? Accept it and move on., but the webcomic itself (Both homestuck and problem sleuth) is like sweet ambrosia from the gods.

     



  • @dhromed said:

    @mahlerrd said:

    that semi-coherent rambling
     

    You're going to have to be a little more specific. I don't care about the wiki, I don't care that people are insane enough to create and maintain a wiki for a $#! webcomic, but hey you know fandom; whachagonnado? Accept it and move on., but the webcomic itself (Both homestuck and problem sleuth) is like sweet ambrosia from the gods.

     

     

    [pls ignore mah stupid post] Thanks for clarifying - you hadn't seemed insane* to this point.  

    *Not much, anyway. Not like a certain someone and his fetish for moon-eyed colorful ponies.

     



  • @mahlerrd said:

    you hadn't seemed insane* to this point.  
     

    INSANE?

    I?

    I?

    well yep.



  • @mahlerrd said:

    On another note, is that semi-coherent rambling really what you kids read nowadays?

    Hmmm, I don't consider the internet as a whole worth my time so I have no idea



  • @serguey123 said:

    Hmmm, I don't consider the internet as a whole worth my time so I have no idea

    Not suprisingly, I have heard that "the internet as a whole" feels the same way about you  <grin>



  • @TheCPUWizard said:

    @serguey123 said:

    Hmmm, I don't consider the internet as a whole worth my time so I have no idea

    Not suprisingly, I have heard that "the internet as a whole" feels the same way about everybody  <dark grin>

    FTFY







  • Hey, guys.

    So, uh, what's going on in this thread?


Log in to reply