News for hackers. Stuff that matters.
Re:Ask YC: Does anybody enjoy unit testing their code? by nostrademons on Thursday June 12, 2008 @01:39AM (#215692)
I do. I used to consider it a necessary evil - I hated unit testing, but I hated not unit testing more. But then I started using the green bar as my first indication that the code works. Everybody likes seeing their code work, so naturally I liked seeing the green bar. I'd just write a test and have it pass instead of running the program.

(Naturally, I'd run the program afterwards to make sure it really worked - but if it didn't, I could just consider that a bug in the tests, write the test, fix the code, and close the bug. Everybody likes closing bugs, so there's the reward...)

Doctest is great too, since it's pretty common to use the Python interpreter as the first indication that your code works. Then you just paste the session transcript into the docstring, and you're done.

Re:Ask YC: Does anybody enjoy unit testing their code? by ScottWhigham on Thursday June 12, 2008 @09:46AM (#215917)
For anyone reading this w/ a .NET/C#/Visual Basic bend, NUnit is one of the big unit testing tools (and yes you get the big green bar [or you aspire to]). VS2008 has unit testing built in.
Re:Ask YC: Does anybody enjoy unit testing their code? by jamongkad on Thursday June 12, 2008 @01:40AM (#215693)
Hang on what green bar are you talking about? is that a feature of your IDE or something?
Re:Ask YC: Does anybody enjoy unit testing their code? by felipe on Thursday June 12, 2008 @01:52AM (#215703)
He is talking about an IDE feature that indicates that, well, your test passed!

http://www.eclipse.org/ajdt/EclipseCon2006/shots/junitTestsP...

The idea is that you write a few lines of code, test it (most likely you'll get red), and you keep fixing your code until you get green, and only then you proceed to the next task.

As far as I know, it started with jUnit on Eclipse, and then others implemented the concept on other languages / IDEs.

Re:Ask YC: Does anybody enjoy unit testing their code? by musiciangames on Thursday June 12, 2008 @04:09AM (#215756)
JUnit was derived from SUnit in Smalltalk.

In Smalltalk/Squeak, you can write the Unit tests and the code you're testing alongside each other, live, from the debugger. It certainly makes things easier being able to see the live objects, in deciding how they should behave. And by testing the objects in situ, you pretty much know your code is going to run as you expect.

Re:Ask YC: Does anybody enjoy unit testing their code? by jamongkad on Thursday June 12, 2008 @02:03AM (#215708)
Sweet....is there something similar for VIM?
Re:Ask YC: Does anybody enjoy unit testing their code? by mullr on Thursday June 12, 2008 @02:37AM (#215724)
In emacs they call this general capability 'flymake', I think. Perhaps that+google will get you what you want.
Re:Ask YC: Does anybody enjoy unit testing their code? by euccastro on Thursday June 12, 2008 @12:12PM (#216036)
It's a feature in some implementations: a progress bar advances while your tests execute, and finally turns red if any test fails, or green if all passed.

The term "green bar" is used, by extension, to refer to the notification that all tests passed, even in colorless console-based frameworks.