r/programming • • Apr 29 '14

Programming Sucks

http://stilldrinking.org/programming-sucks
3.9k Upvotes

1.1k comments sorted by

View all comments

Show parent comment

31

u/quangdog Apr 29 '14

Testing? QA? That's what end users are for.

6

u/[deleted] Apr 29 '14

Ya seriously. It bothers me though that the idea of automated testing is seen as a "luxury" to many testers... they work with computers for fucks sake.

9

u/aladyjewel Apr 29 '14 edited Apr 29 '14

Yes, and running automated tests requires configuration (and knowledge on how to do that), both for your testing tools and the product you're testing. Voila, welcome back to the "there will always be darkness" block from OP.

It's a shitty excuse, but it's still valid.

11

u/[deleted] Apr 29 '14

The problem is two fold

  • Testing/documentation is hella boring
  • Sales/management don't care. They want shippable code as soon as possible. Spending weeks on automating a test suite is seen as a waste of money.

4

u/SHv2 Apr 29 '14

Non-value add is what I hear thrown around. :/

4

u/[deleted] Apr 29 '14

It's competing sides of the same coin.

  • Managers want to look as if stuff is flowing out the door
  • Developers want to be seen as not taking too much time and making the code hard to work on means that scaling becomes harder. Original developers become the focal point of all new work meaning they're "important."

Any good project should within reason scale and survive the bus test [re: your lead developer is hit by a bus, how fucked are you?].

The problem is scalability is often a problem for future you. But present you doesn't care about that.

4

u/UsingYourWifi Apr 29 '14

When explaining the benefits of automated testing to skeptical developers, the concept that seems to get the most traction is that tests are "features" written for the developers. It's creating a magic button that will tell them whether or not the code they've just written will result in them being woken up at 4 am to fix a live site issue.

3

u/[deleted] Apr 29 '14

I avoid the latter issue by not being employed by companies that require that.

2

u/Stormflux Apr 30 '14 edited Apr 30 '14

My biggest barrier to automated testing is that 90% of my code is either interacting with a database or passing views / json to a web browser.

At the Controller level, it's kind of pointless to test that "return View("Index")" returns a view called Index. We already know that's going to work, but now we have the added overhead that if we ever change it to "return View("Home"), the test is going to complain.

And at the Database level, the part that's going to go wrong (the SQL / Entity Framework statements) is abstracted away by Mocks and Fakes. So... what am I supposed to do?

3

u/UsingYourWifi Apr 30 '14

So... what would you say your code does here?

Is there any behavior that can be tested?

2

u/Stormflux Apr 30 '14

It talks to the database to the controller doesn't have to. It has people skills!!

2

u/dnew Apr 30 '14

The right way to do mocks is to test two levels down from what you're doing.

The JS tests that invoke the web server don't mock out the web server; they mock out the database.

The server tests don't mock out the database; they mock out the underlying file system.

If you're mocking what's directly underneath you, you're not going to get any benefit.

3

u/Omikron Apr 30 '14

The problem in my experience has always been a lack of 1. time and 2. give a shit by the people prioritizing tasks. Sure if I ran my own business and had no deadlines ever I could write perfect code with perfect automated tests and doves would fly out of my ass.

Instead I've got 5 different department heads all asking for 5 different features to be added to 5 different apps and they want it done 5 times faster than it would take to do it perfectly correct.

2

u/[deleted] Apr 30 '14

Ya that's why explaining the concept of scalability is important.

3

u/dnew Apr 30 '14

Remember the good old days? When "alpha" was the term for software you haven't shown to customers yet, let alone sold to them as an "early access" perk?

2

u/NormallyNorman Apr 29 '14

UAT where I work. It's management by firefighting committee.