News for hackers. Stuff that matters.
Re:Questions to ask your potential employer by novaleaf on Saturday November 09, 2013 @09:23PM (#6704816)
I totally agree with this. I personally do not use unit tests at all.

Why? Because I do assert-driven testing. My test code is integrated into the actual business logic. So no need to contrive scenarios.

Re:Questions to ask your potential employer by rmc on Sunday November 10, 2013 @06:52AM (#6706122)
So you do do tests, just not specifically separate unittests.

That's totally different from an organisation that doesn't do tests at all (yes they exist).

Re:Questions to ask your potential employer by novaleaf on Monday November 11, 2013 @10:32PM (#6715686)
yes, but if someone asks me in an interview if we do unit testing, the answer is really a no...

so maybe the takeaway is if people don't do what you expect, maybe digging a little deeper before running away screaming ;)

Re:Questions to ask your potential employer by ababab on Sunday November 10, 2013 @12:26AM (#6705362)
Could you expand on what you mean by assert-driven testing? I'm not finding any good explanations from a Google search. Sounds interesting.
Re:Questions to ask your potential employer by throwaway1979 on Sunday November 10, 2013 @06:30AM (#6706074)
My GUESS was that he/she means that the code has asserts in it that check if something is not right at runtime. I personally would not call that a replacement/alternative for unit tests. In fact, it may be counterproductive ... a small error in the code would bring down and entire application.
Re:Questions to ask your potential employer by novaleaf on Monday November 11, 2013 @10:28PM (#6715676)
i would counter this by saying that a small error in code SHOULD bring down the entire application.... during development. otherwise the error is not visible to developers when they can best/easiest fix it.

of course, asserts should not crash the app once it's in production. instead they should be channeled to a log that gets sent back to the production support team for analysis.

but during development, I'd say crashing during small errors is a great thing.

Re:Questions to ask your potential employer by Rodeva on Sunday November 10, 2013 @06:37AM (#6706087)
Assert driven testing means that the tests are part of the actual code that is running. It's helpful because when an assert fails, the stack trace is right at the position where it failed. In many ways it's an easy way to incorporate testing into your application without the need for an additional framework.

A simple example can be done by writing a single function in the root scope or some global function (javascript)

function assert(assertion, description) { if(!assertion) { console.log(description); //could also have other application error handling code } }

Then in a function in your application:

function myFunc() { var x = 1; assert(x == 1, "x does not equal 1 in myFunc()“);

\\Continue code... }

This is obviously a very simple example and can definitely be iterated upon, but it gets the basic point across and I'm on my phone so writing code isn't the easiest :-P

Some systems have something like this built in, such as node which has more features.

http://nodejs.org/api/assert.html

Re:Questions to ask your potential employer by lvillani on Sunday November 10, 2013 @06:56AM (#6706132)
Sounds like Design by Contract.
Re:Questions to ask your potential employer by novaleaf on Monday November 11, 2013 @10:30PM (#6715680)
i think that's right, but maybe more "agile" in that there is no explicit contract being fulfilled, just what the developer ensuring valid input and output to the functions they implement.
Re:Questions to ask your potential employer by eru on Sunday November 10, 2013 @06:08AM (#6706030)
Without scenarios, how do you run your code before it goes into production?
Re:Questions to ask your potential employer by novaleaf on Monday November 11, 2013 @10:26PM (#6715672)
i use the combination of assert-driven development + UI/UX testing. (manual, but that could be a valid candidate for automation in my projects)

so I'm not saying there are no scenarios, but they all end up being the customer facing scenarios, and verifying those meet expectations. Also just developers making sure the functionality "works" naturally catches the technical bugs (because asserts in production code would cause the app to crash)

Re:Questions to ask your potential employer by eru on Tuesday November 12, 2013 @05:15AM (#6716875)
You might be interested in `contracts' which are basically assertions on steroids. See https://en.wikipedia.org/wiki/Design_by_contract (or http://blog.racket-lang.org/2012/11/contracts-for-object-ori...) for an introduction.

You might also want to explore QuickCheck, which helps to generate these scenarios.