17 ms·
Poll: Do you test your code?
Do you have tests that run every time you push and ensure that the functionality on your site works?
There's always a lot of debate around testing and I'm interested to see how much people do and how satisfied they are with it
IF YOU'D LIKE TO ENCOURAGE OTHERS TO ANSWER, PLEASE UPVOTE - TY
- ctdonath 15y agoMedical product. Heck yeah we test everything.
- gbog 15y agoWe have a test suite covering most of the code. We'd like to do more testing are doinh it.
- deleted 15y ago[deleted]
- mraxilus 15y agoIndeed. Travis-ci.
- darinrogers 15y agoIn my experience, on projects with often-run automated unit test suites with good coverage, development goes faster. Part of this might be because for code to be highly testable, it usually also has to be well-designed and architecturally sound.
- tomgallard 15y agoI agree. When interviewing I can usually weed out those who write tests (and write good tests) from those who just claim they do. How? People who don't really write tests will tell me that the advantage of unit testing is being able to see when code changes have broken stuff (which is fair enough and true). Those who regularly write unit tests will probably bring this up- but often their first point will be 'It helps to structure code properly, make me think about dependencies, modularise code appropriately'
- reddit_clone 15y agoYou are mixing up automated Unit Testing with TDD. They overlap a lot but they are not the same. There are people who could write quality software with good test coverage without following TDD style.
- shin_lao 15y agoNever forget you write software, not tests. Tests are here to increase quality, they have no raison d'être by themselves.
- latch 15y agotests are a lot more about design and refactoring than they are about quality.
- angersock 15y agowhat what are you even saying i dont even ( More concretely, if you use testing to drive your refactors and architecture--as opposed to, say, finding pain points in normal code or actual design time in preproduction--I would be concerned that you are "guardrail programming", as a gentleman put in a talk I saw recently. When we drive, we don't have guardrails to bounce us back on the road every time we veer off--they're there to protect us against accidents or when something goes seriously wrong with our vehicle. If you told somebody that you drove from city A to city B by hugging the guardrail, they'd say you were nuts. Similarly, depending on unit tests to do design is strange--they're there to be sure that your code functions according to contract. )
- tomgallard 15y agoI disagree completely, and your comment makes me think you've never seriously used unit testing. Writing tests makes you think about how pieces of your code interact with each other, dependencies etc. As an example, if you're trying to test Function A and are finding you need tens of lines of setup code to be able to do so, then that would be a warning sign that you may want to think about refactoring out some of those dependencies
- TylerE 15y agoI've seen code in productions apps with comments along the lines of "this isn't optimal, but it's easier to test". Every time I do, I die a little inside. Unit tests are THE most overrated buzzword of the last 10 years.
- peteretep 15y agoPeople ... don't have tests? o_O In 2012? I am seriously considering putting together a "Software Engineering for Small Teams" course or set of articles. With a little bit of expertise, you can inject testing in to most projects, use the minimum of Agile that'll help, and generally massively raise your game - and by that I mean code faster, better, and more reliably, with considerably less stress. (edited: turns out I forgot which year we're in :-P)
- podman 15y agoEven more amazing... it's 2012!
- tfb 15y agoSometimes I'll forget what year it is too, or maybe that was just a typo. But my OCD just isn't letting me let this slide... *2012
- mtrimpe 15y agoI think it all depends. I used to always write proper full-fledged tests. Then I started my startup, building a product in the few hours left after a demanding high-stress job and a tumultuous private life. Within a few weeks, I stopped writing tests. Within a few more weeks, I turned off the test suite. I wrote the product, got it working, received market feedback, realized my model was all wrong, rewrote the entire domain model and UI multiple times all to finally realize that my component boundaries were all wrong and intuitively understanding where they should've been. Now I feel confident about an architecture that will stay stable for 12+ months and each new component I write is properly tested. In the meanwhile my lack of tests is starting to bite me very slowly, but I find that I'm just slowly replacing all 'bad parts' with properly tested components with clearly defined boundaries, rather than changing existing code. And in the end I'm really happy that I decided not to test as much. It has it's place but when your time is really precious and you're trying to mold your software to fit the market needs, it just isn't worth it. I don't know how many others are in a similar situation but, for me, sometimes it just ain't f*ing worth it.
- peteretep 15y ago
- kevinherron 15y agoI don't believe anybody that says they test all functionality. Most? Sure. All? No way. Not in a non-trivial codebase. Article about the group that writes the space shuttle software, sort of relevant?: http://www.fastcompany.com/magazine/06/writestuff.html http://www.fastcompany.com/magazine/06/writestuff.html
- peteretep 15y agoWell, there's `all` and there's virtually all. All is 100% branch and statement coverage, and is a big waste of time. When I saw my codebase has 'all' functionality tested, I mean we don't commit code without tests included too. I think that's a pretty reasonable definition.
- stephencanon 15y ago100% branch and statement coverage doesn't begin to cover "all". Consider: double sin(double x) { return x; } Simply testing x = 0 gives you 100% branch and statement coverage, but I don't think you want to ship just yet =)
- amouat 15y agoThat's not entirely fair - you haven't tested the branches or statements inside the sin function. However, even if the sin function is already tested elsewhere, you will still need further testing to ensure that you are calling it correctly (e.g. not confusing degrees and radians). EDIT: Yes, I read it wrong - clearly need coffee...
- Someone 15y agoThe original poster gave an implementation of sin(), not a unit test. That implementation has no branches in the source and, for any decent compiler, will not have any branches on the machine, either.
- wpietri 15y agoPerhaps you need to read it a little more closely? For the given function, he has indeed tested all the branches and statements.
- tfb 15y agoWhere's the option for "We thoroughly and immediately test every change (and all affected processes) ourselves to also ensure UX is top notch"?
- Achshar 15y agoThis. I basically do this because it's quick and does not need any extra code, esp because I write web apps and testing it is just a ctrl+S away. No compilation, just F5.
- mildweed 15y agoTesting? Shoot, we sometimes code in prod! http://www.bnj.com/cowboy-coding-pink-sombrero/ http://www.bnj.com/cowboy-coding-pink-sombrero/ (article's not mine, but might as well be)
- dutchbrit 15y agoI usually test everything with Selenium - what are other good methods?
- pooriaazimi 15y agohttp://phantomjs.org http://phantomjs.org and http://casperjs.org/ http://casperjs.org/ are amazing (and open source).
- dutchbrit 15y agoThanks!!!
- Mc_Big_G 15y agoThe day I changed one line of code and 100+ tests failed was the day I really got it.
- boyter 15y agoAlthough that could just be a sign of brittle tests....
- linguistbreaker 15y agoI don't always test my code, but when I do I do it in production. Stay thirsty my friends.
- linguistbreaker 15y agoI don't always test my code, but when I do I do it in production. Stay thirsty my friends.
- danmaz74 15y agoOn my latest project (Rails 3.1) I test thoroughly the back end code, but only in a limited way the CS front end code. I'm using jasmine there, but that is a lot of overhead.
- fauigerzigerk 15y agoWe would like to test a lot more but I really don't know how to test some of the critical stuff. Just as an example, how do you test a parser that processes large amounts of sometimes sloppy semi structured text? Whether a particular defect should be classified as a bug in my parser or as a rare glitch in the source data is undecidable until I know how often the defect occurs. What I need is a kind of heuristic test framework that makes sure the parser doesn't miss any large chunks that I only find out about weeks later if at all. I cannot supply individual test cases for everything that could possibly be found in the source data.
- brown9-2 15y agoI cannot supply individual test cases for everything that could possibly be found in the source data. Perhaps not, but you can supply test cases for known problems you might encounter, as well as ones you've solved after they've been encountered.
- fauigerzigerk 15y agoYes, that's what I'm doing, but I feel it's a drop in the bucket.
- de90 15y agoIt is, but as bug crop up you can add tests to ensure they don't crop up again. While it's not possible to ensure perfection, it does help ensure you don't 'revert back' to past problems.
- sateesh 15y agoAlso don't forget the tests you add help you with the regression tests. The large set of tests would assure you that the new fix you do will not lead to any other bugs that you had fixed earlier.
- Achshar 15y agoI write web apps and I don't do any testing at all. I am also a unit testing newbi. I just run the app and make sure what change I made works. No automated testing what so ever. it just works and I believe it will be an unnecessary over head Is this bad? If yes, how can I unit test my JavaScript?. Plus i always thought UT is for code that compiles, right?
- lightyrs 15y agoLook into Jasmine BDD for js testing. We use it for all our js and it has greatly improved quality and reliability.
- davemo 15y agoI went through an experience where 2 years ago I thought "I hate unit testing, don't know how to do it and don't see the value". 2 years later I think "I enjoy unit testing, know how to do it well, and see the value in unit testing _most_ of the time". I believe this transformation is entirely to do with the fact that I paired with a brilliant developer every day for 6 months who really helped to answer all my questions and show me how to test a variety of different things. I truly believe that unit testing (and testing in general) is a hard thing to grasp without being able to learn from someone over a long(ish) period of time. I realized that I hated testing because I didn't know how to do it and wasn't good at it. I also didn't understand what the essence of a unit-test was; my tests would often cross multiple integration boundaries (ie: hit the db and the server) and were really more like bloated integration tests. Once I had sorted that out and was able to see a variety of techniques for testing specific scenarios I realized that I actually enjoyed testing and the satisfaction of knowing my code was covered against defects started to be a big motivator. To answer your specific question about JavaScript testing, I've been using JasmineBDD[1] for the last 2 years and have found it a joy to use. It really makes testing things easy and has tools that allow you to isolate your tests down to the individual units. [1] http://pivotal.github.com/jasmine/ http://pivotal.github.com/jasmine/
- gruseom 15y agoI paired with a brilliant developer every day for 6 months who really helped to answer all my questions Sounds great. What else did you learn?
- ChrisNorstrom 15y agoI used to get code back from developers EACH AND EVERY TIME with massive bugs like: unable to register, unable to login, unable to add content. I wrongly assumed that they at least ran through and checked for any bugs they introduced before sending me the new code. So each and every time I got code back I had to go through manually and check it, sign in, log out, register, add content, delete content, edit content, add category, etc... I wish someone could make a simple service that allows me to set up my web app, set up test parameters that it tests each and every time, and tell me if it failed or not. I want to automate my babysitting.
- woogley 15y agoI'll just leave this here. http://saucelabs.com/ http://saucelabs.com/
- jurre 15y agoI think you could use something like like selenium? Should be fairly easy to test the basic things you would normally do manually.
- _chap 15y agoI think https://stillalive.com/ https://stillalive.com/ will do what you want. Their landing page is a little weak but I dig their UI for setting up tests.
- damoncali 15y agohttp://fakeapp.com http://fakeapp.com
- mootothemax 15y agoSelenium is not the prettiest tool out there, but as the homepage says, Selenium automates browsers, making it ideal for running tests that you describe: http://seleniumhq.org/ http://seleniumhq.org/
- benmathes 15y agoYou should check out saucelabs.com
- Nogwater 15y agoHonest question: Do you believe that test == automated test?
- beersigns 15y agoCurrently working a webapp with a legacy(2002ish) java code base with a fair amount of testing but it's not even close to full coverage. JMockit has gone a long ways to towards making it easier to expand the test coverage but it's difficult to find time to make significant impact.
- hndl 15y agoAnother interesting question: how often do your tests run? Most folks probably run unit tests with continuous integration but what about functional and performance driven tests?
- MartinCron 15y agoMost tests (unit, integration, etc.) are triggered when new code is checked in. For other kinds of tests, we use schedule triggers to run them at a particular cadence, either overnight or more frequently if that's what needed. TeamCity is good for automating with both kinds of "triggers".
- pbiggar 15y agoContinuous integration should run all your functional and performance tests if possible. Each "unit" (could be a commit or a push or a merge depending on your philosophy) can cause errors, and being able to pinpoint the unit in which the fail happened is immensely valuable. If you have something really long running (eg you make a database and have a two week test), then you may be able to minimize your test (possibly automatically) and use git/hg bisecting to find it. Fuzz testing (finding holes in your code) can be run separately, and again, you can find the root cause through minimization and bisecting.
- PHLAK 15y agoWe don't test code where I work, but I'm strongly for testing.
- binarycrusader 15y agoUnit testing is the salvation of anything but the most trivial of projects. Sometimes, it can be frustrating to have to stop and write a unit test before send out something for further review, but computers are more reliable testers than humans are. Learn, use, and love unit testing, or face the consequences.
- perldork 15y agoWhere is the "we'd like to do more testing" without the negative excuse option? :)
- bemmu 15y agoI don't test as much as I probably should, because it seems cumbersome since I am mostly dealing with APIs like Facebook. For example, if a user revokes their Facebook OAuth app token they get an email notification about that from me, informing them that the app will no longer be able to function because of the expired token. I am not automatically testing that, perhaps I am missing something, but automating the steps to log in to Facebook and revoke the token and then also making sure that SendGrid sent the email correctly just seem impractical.
- wpietri 15y agoPersonally, I do end-to-end tests for some basic cases just to make sure everything works together. But most of the tests are more fine-grained. So in your example, I'd test the core logic against fake Facebook API responses and a fake outgoing email call. That lets me easily test some of the weirder cases. E.g. if Facebook breaks, will the job skip that user and keep going rather than blowing up?
- tjstankus 15y agoYou don't want to test external APIs. You probably do want to test how your application behaves in response to using the APIs. One way is to mock the API calls with canned responses. Another way is to use a tool like VCR (https://github.com/myronmarston/vcr https://github.com/myronmarston/vcr) to record and playback API interactions.
- fudged 15y agoManual testing has it's value as well. Automated testing isn't always cost-effective or simple.
- letuboy 15y ago"I don't always test my code, but when I do, I test it live." I wish I wrote tests more. Maybe I'm to impatient. :(
- petercooper 15y agoYou probably just don't know how to test properly yet. Testing should ultimately give you more time and make your life easier. If it's making it harder or making you take longer (unless it's a really trivial task), it's not being done correctly (yet).
- tel 15y agoI work in science. We agree that testing would be beneficial, but nobody codes well enough to actually get it done. To all language designers, there is a HUGE space for a better scientific language. Make it easy for Matlab users to understand, but include better encapsulation and library support. Tie in testing and proving from the core.
- densh 15y agoYou might want to check out Julia[1] programming language. I have absolutely no idea how good or bad is it but considering the fact that it's so young -- you are still able to influence it's development (e.g. suggest better testing capabilities) if you really wanted to. [1] http://julialang.org/ http://julialang.org/
- tel 15y agoThe webpage is down, so I'll take a look at it later. I'd like to see some simple examples of things as well. It should be a one-liner to import a CSV file and do a least squares regression on different columns. It should also be a one liner to open an image, compute it's 2d FFT, and display it. It should also be one-liners to do numerical quadrature integration, compute the solutions to some ODEs, and maybe even backpropagation training of a neural network with just one layer.
- achompas 15y agoWhat about NumPy + unittest + all other Python libraries?
- tel 15y agoNumPy is making pretty strong headway in many communities. It's still not Matlabby enough for the majority, though. It doesn't make a clear improvement, so I think many see it it as just poorly replicating the features of Matlab for free. It's also pretty notoriously difficult to install, especially if you want LAPACK/BLAS. I wasn't able to get it running on many of our servers for that reason and had to revert to Matlab.
- tel 15y agoI work in science. We agree that testing would be beneficial, but nobody codes well enough to actually get it done. To all language designers, there is a HUGE space for a better scientific language. Make it easy for Matlab users to understand, but include better encapsulation and library support. Tie in testing and proving from the core.
- obiefernandez 15y agoThese options are flawed. I am somewhere in the middle of of the first two: mostly integration tests, with critical domain logic unit tested. Certainly not 100% of the app's functionality, closer to 80%
- trustfundbaby 15y agoAgreed. would have been great if manual testing was included. We have full time QA people who actually write very detailed test plans based on project specs/requirements and have time included in all our projects for testing and bug fixing at the end.
- joefiorini 15y agoI'm had the same thought Obie. I find high level integration tests provide most of the value for me, with unit testing when I need help with designing code. Having a decent suite of high level tests saves me from having to smoke test the entire app every time I make sweeping changes. If the suite is passing, I know the features are working, at least in the basic cases I was testing for. I still have to do some level of manual testing, but it's nowhere near as much as I did before I became more obsessed with testing.
- geebee 15y agoInteresting... I think I'm with you on this one. There have been a few occasions where I got my test coverage through integration tests rather than unit or functional tests as well. My real goal is to have tests that will sound the alarm if I've done something that breaks the application. I think this is similar to the "smoke test" you're talking about. Don't want to have to fire up the server and walk through all the use cases - it's very useful to have integration tests that will do this instead.
- geebee 15y agoI agree. this poll forces me to choose between a test suite that tests "all functionality" and "a few critical things". I think a lot of people who value high levels of testing coverage still fall somewhat short of all functionality, but are way above "a few critical things". I'm using rails these days, and I have 100% test coverage on models and controllers (though that really just means that all the model and controller code is executed when I run my tests, these tools can't really tell if you've tested the code intelligently, though I hope I have). I don't have a full suite of integration tests that validate all of the view logic, though there are some checks. I also have integration tests that validate external dependencies (file storage, database connectivity, etc), though again, there may be some holes. I picked "all", since that's closest to where I am. But my best choice would be "we maintain a high (95%+) level of testing coverage". I don't think I'm splitting hairs here, because there may be a practical tradeoff between high levels and complete levels of test coverage. NOTE: "high" levels of testing can mean different things to different people... doesn't have to be 95%, which I would consider to be higher than absolutely necessary. It depends so much on what you're actually testing (anyone who has used a coverage tool knows you can often "trick" the tool into awarding the 100% bar without doing much other than just making sure the tests run the code... which is useful in its way but can let all kinds of errors slip through).
- krosaen 15y agoI'm pretty much the one man code shop for our startup and I still write a lot of tests. The way I think of it is this: if something is tricky enough that I need to verify it in the repl, may as well capture that validation in an automated test. The trickier, more painful tests to setup are integration tests that make sure everything is hooked up correctly, from the datastore layer to the handler to the template arguments etc. I went through the pain to set this up so that we at least have smoke tests, e.g every page is visited with some data populated to make sure nothing blows up. A good reason to write tests beyond QA is to verify your code is at least somewhat modular - being able to get code under test ensures at least one additional use beyond being hooked into your application. For that reason, I would recommend having at least one test for every module in your code. It also makes it easy to write a test to reproduce a bug without having to refactor your code to be testable after the fact.
- cheddarmint 15y agoHow about an option for: "Mixed bag: some components are exhaustively tested, others not at all, many in between."
- TwistedWeasel 15y agoYou need an option for... We have a test framework and a devoted team of people dedicated to encouraging the use of said framework but the rest of our engineering staff don't get it.
- kshitiz_grgs 15y agoWe have test suite that automatically runs when new commits are pushed to github.
- jakemcgraw 15y agoMVP BABY, AIN'T GOT NO TIME FOR TESTIN
- tomjen3 15y agoI don't have a problem with the idea of test, as such, but I couldn't use them since I write webapps and what gives us issues isn't the Javascript code (about 80%) of the time. It is the CSS, or failing that, the interaction between Javascript and CSS, which I haven't seen any way to test automatically (such test would be able to answer 'given this code, does the resulting DOM look like picture $N'). Usually when there is something wrong with the Javascript it blows up in our faces. So if anybody knows of a testing framework that can do this, please tell me about it.
- fionatay 15y agoJasmine is a behavior-driven development framework for testing your JavaScript code. http://pivotal.github.com/jasmine/ http://pivotal.github.com/jasmine/
- d-roo 15y agoI was in the 'testing is too much overhead' crowd for years until one day I finally got it. I realized that as I code, I'm always testing. Who doesn't make a change and then test it? So, you consider writing a test too much overhead? How much overhead is it to manually test? How much overhead is it to fill out that registration form you're testing? Maybe there are two or three steps to it. How much time does that take each and every time you test? Being one that enjoys automating repetitive tasks, writing that test _once_ suddenly became a no-brainer. This realization only made all the other arguments for testing that much stronger.
- swalsh 15y agoThere's a lot of truth to this. I work in a project with a lot of separate assemblies, because we have many applications that share similar functionality. Unit tests are critical to making sure I don't break something for one application while making a change for another. However at the same time, It can be a real pain to load the entire application to test it. Unit tests have actually increased my productivity in some areas where doing a test has about a 1-5 minute overhead (compiling than loading a file etc)
- MartinCron 15y agoTrue story: I took over for a developer working on a large and complex multi-step form. I wasn't surprised that there were a few little bugs in it, but I noticed that the number and severity of the bugs increased as you went through the form. The first step was pretty much bug free, but the final step was completely broken. Many people who claim that test automation is "too much overhead" either don't understand what test automation is or don't understand what overhead is. If you have to test everything in order to change anything you either have a huge manual testing overhead or have a huge quality liability.
- fudged 15y agoBeing in a software testing class right now, I'm absolutely shocked how many "minimal/no testing" responses and comments there are.
- fatcoder 15y agored - green - refactor! It really saves time and heighten the cohesion. 4 me at least.
- coderrr 15y agoplease read this book: http://www.amazon.com/Facts-Fallacies-Software-Engineering-Robert/dp/0321117425 http://www.amazon.com/Facts-Fallacies-Software-Engineering-R...
- jsvaughan 15y agoIf you haven't got tests, you can't automate your deployment. If you can't automate your deployment, you can't rapidly iterate.
- swalsh 15y agoI write tests today to make sure it works tomorrow. As projects progress, inevitably no matter what kind of ninja coder you are, a requirement that is beyond what you could have imagined will pop up. You can either say, no we can't do that... loosing a competitive advantage. Or you can can code without fear. Because when you're done, you have a full suite of sanity tests waiting to make sure you didn't mess things up. Unit tests can make an average guy like myself appear to be that Ninja coder those job ads are always asking for, the guy with the oakley glasses.
- snambi 15y agoI do the testcases based on where the project is at that point in time. Here are the three stages, that can help you decide how much tests needs to be there. [1] Initial stage where we are trying to make things work. At this stage code base is very small < 1000 lines. This is like prototyping. It works with limited functionality. No tests needed at this time. [2] Heavy development phase. At this stage, we have proved the concept. Now we are adding a lot of new features. We identified some features as must have. Also, code is getting re-factored/re-designed based on what we learn. At this stage, we add tests for the must have functionality. Thus, we can ensure that important features are not broken by newer code. [3] Mature phase. The code is mature. Most of the features are working fine. Code base may be large 100000+ lines. At this stage re-factoring/re-designing is not easy. Mostly incremental changes are happening. At this point, we should have upwards of 70% code coverage. Typically, the test code will be more than the code when we have 70%+ code coverage. But, it is very important to have tests, since it ensures that all features are tested even when a minor code change is made.
- abruzzi 15y agoIf by test you mean "try out". Nothing formal.
- Havoc 15y agoOutsourced that to the end user. /joke
- scott_w 15y agoOne thing that automated tests do well is repeating bugs that your user finds. Sometimes it can be tricky (replicating the conditions of their data set comes to mind), but it's quite good for preventing regressions. That said, they can give you a false sense of security. If your test is wrong, it can allow bugs to slip through the net until your user picks them up at the worst possible time.
- Jach 15y agoI test things that seem like they're important to test. I also do a lot of manual checking which boils down to "does it work?" When the manual checking is too tedious I'll write code to help. I don't do unit tests (but I don't think most people who think they're doing unit tests are, either). In general I have three big problems with the philosophy of testing, especially test-first. (Though I don't feel incredibly strongly about these--software is a big field of possibilities, to suggest One Way is the Only Way is pretty crazy.) The biggest is that it encourages carelessness. I want to grow more careful and work with careful people, not the other way around. Tests don't seem to make people better at doing science--that is, people test the happy-case and don't try and falsify. Testing doesn't seem to make people better are writing code, and may even be hurtful. Secondly, testing instills a fear of code, like code is a monster under the bed that could do anything if you don't constantly have a flashlight under there pinning it down. Sure, I guess your entire project might depend on that one innocent-looking line of code you just changed, but if that's true, you have some serious design problems and testing is going to make it hard to fix those. Because, thirdly, it hinders design, it's very easy to code yourself into a corner in the name of passing a test-suite. Related to the design issue is a simple fact of laziness. Your code makes a test fail. Is your code wrong? Or is the test wrong? Or are both wrong? If just the code is wrong, the correct action is to fix your code to fit the test. (Which may have serious ramifications anyway.) If just the test is wrong, the correct action is to change the test. (How many people test their tests for correctness? Then test their test-testing programs for correctness? "Test all the things!" is an infinite loop.) If both are wrong, you have to change both. Obviously people will be motivated to assume that only one is wrong rather than both because both means more work.
- ericHosick 15y agoAsking if the tests are correct is really asking if the requirements are correct. If this happens a lot it means developers are writing code before they really understand the requirements. If developers have to re-write behavioral level tests a lot, it probably means the product owner/project manager/managers/stake holders/etc. are changing the requirements. A lot of pain should be felt gathering and verifying what the customer wants before a single line of code is written. Really, code is bad and as little of it should be written as possible. Developers should yell loudly when they have to re-write behavioral level tests. Testing at the behavioral level/systems level/UX level is really verifying a lot more than just "is this code right". It provides a way to check correctness on the specifications, correctness on the behavior, complete coverage of expected usage by the end user, and assures that only the code necessary to get the behavior to work is being written (to name a few). The carelessness I see are developers writing code without fully understanding the needs of the stake holders. The industry would be in a lot better position if managers/product owners/stakeholders/etc. were expected to provide a good set of behaviors to develop against (as an example, Gherkin or similar tools) before they start pushing developers to "deliver something on time". Note this is at the systems/behavior level and not at the Unit level. Unit level tests provide robustness. Developers can never assure that software has no "bugs". Behavior level tests assure completeness. Developers can assure they are meeting the requirements (Developers can't assure they are making what the customer wants: but that is not the responsibility of a developer. That is the responsibility of product owner/project manager/etc. I'm not saying that a developer can't ware that hat, but a developer not wearing that hat should not be held responsible for failings to provide for the wants of the customer). All that being said, I can not emphasis enough how important I think Behavior Level testing is. My 3 cents.
- maratd 15y agoTesting is really the last stage. Few software suites get there. Yes, yes, I know you're supposed to build with it in mind from day 0. And if you do that, you may never get to the finish line. You exert every ounce of energy you have to making a viable product. You worry about everything else afterward.
- Oompa 15y agoNope! You should be writing your tests along with your code. Not "keep it in mind" actually write them. My first step in a new project is `mkdir spec`.
- callmeed 15y agoI answered "a few critical things" ... but, for the most part, testing is tedious, frustrating, and a time-sink for me. I recently paid someone $100+ an hour for some remote TDD coaching. It's helping a bit but hasn't really change my attitude towards testing (yet). What bugs me: - Testing frameworks and "best practices" change way faster than language frameworks and I simply can't keep up. What rspec version do I use with what version of Rails? Now I have to use Cucumber? I learned some Cucumber ... oh, now Steak is better. [rage comic goes here] - Most bugs/edge cases I encounter in our production apps are things I'd never think to write a test for ... - I deal with custom domains, authentication, and 3rd party API calls in almost every app we have. IMO, this adds 20% or more to the (already high) testing overhead just to get these things configured right in the test suite - More code is moving to front-end Javascript stuff ... so, now I have to write Rails tests AND JS tests? Sounds delightful Feel free to try and convince me otherwise, but I don't ever see myself in the "test ALL the things" camp.
- sunir 15y agoPeople write and play with test frameworks because they are procrastinating from writing actual tests. Think about it. Just use Test::Unit and move on with your life. Write some tests. That's what counts.
- eric-hu 15y agoI'm working on a single page app that's about 30% Rails and 70% Coffeescript/Backbone.js. Test::Unit is practically useless for us since users never hit any plain HTML pages besides the login page. Imagine the current HTML5 Pandora having bugs with one particular song in Chrome only. How do you test for that using Test::Unit?
- mattbriggs 15y agothere are a bajillion libraries out there for unit testing javascript (something test::unit-ish would be qunit). rails + backbone + JST style templating actually makes TDDing your js relatively painless
- tonyto85 15y agohttp://blog.8thlight.com/uncle-bob/2012/01/11/Flipping-the-Bit.html http://blog.8thlight.com/uncle-bob/2012/01/11/Flipping-the-B...
- thyrsus 15y agoThanks for the link. So: what about GUIS? How does one formally describe pixels displayed on a screen in a way that captures their ability to correctly communicate with the human intended to view them? So that my notice Please turn off the foo within bar doesn't show up truncated to say Please turn off the foo on all reasonably applicable screens? This example is just one of a googleplex of possible failures.
- stdbrouw 15y agoI think the response anyone is likely to give to this poll depends a lot on the kind of work they do. When I write a software package/library, I'll usually test the hell out of it for the very same reason so many others have given: if you're testing in a REPL anyway, why not just turn those snippets into unit tests? Hardly any effort. But I usually don't bother with too much automated testing for websites or web apps, because (1) it's more difficult to actually catch the errors you care about, have good test coverage and keep tests up to date than it is for back-end stuff and (2) I actually like clicking through my app for a while after I've implemented a new feature or changed an existing one. Manually testing a web app allows you to catch many different kinds of mistakes at the same time. Almost like an artist looking at an unfinished painting. Does the UI look off? Does X get annoying after doing it ten times in a row? Does everything flow nicely? What is this page missing? Did that customer's feature request you got three days ago actually make sense? Questions you should be asking anyway, even with automated tests. And basic functionality is tested because the underlying packages are tested. ... but then again, if I was writing a website backed by a RESTful API, testing that API is as easy as doing a couple of HTTP requests and checking the responses, so you'd be stupid not to go for that quick win. So my answer is "We have a test suite that tests all functionality" and "Tests? We don't need no stinking tests." at the same time.
- yaix 15y agoIts never possible to remember to test for everything. And according to Murphy's Law, what will break is the one thing you forgot to test for. So then, why test at all?
- functionform 15y agoThat's not Murphy's Law, its lack of coverage.
- trustfundbaby 15y agoI've never done automated testing, but as I've grown as a developer and started dealing with more complicated codebases, I have come to see the importance of testing in a huge way. With a small codebase that you know every inch of, its easy to test most of your interactions before you push something live, but when you get just one order of magnitude higher you start seeing how easy it is to write code in one section of your app, test it rigorously, but not catch some subtle breakage in another (seemingly unrelated) section of your app. In production software, especially if you have paying clients, this is simply unacceptable; which is why I've recently been boning up on BDD, TDD, and continuous integration and am trying very hard to slowly integrate them into my development process. To one of the comments before, in my experience, automated testing should actually makes you bolder with code not more fearful. We have this codebase where I work that is a frickin mammoth of interrelated modules and its so scary to go in there and add or change something, because I just know something else is going to break and I'm going to be stuck fixing it for days after I made the first edit. This is the other reason I started exploring automated tests ... because I realized that if I had a test suite that could catch regressions when I refactor code, then I could actually spend more time whipping old code into shape instead of patching it up until such a time when I'd be able to just rewrite the whole thing.
- rhizome 15y agoTrapping regressions is a HUGE driver for testing for me.
- jpitz 15y agoHere's what I clicked: We have a test suite that tests a few critical things We are happy with the amount of testing we do Here's what I would have clicked, if present: We have a test suite that test a lot of things, but probably only represents %75 coverage at best. We'd like to do more testing, and we're continually adding more, but the biggest barrier is cultural.
- randallsquared 15y agoI used "and also..." as my second answer, because none of those others applied. My real second answer is "We'd liked to do more testing and we're working on it as fast as we can consistent with producing the new features and products demanded". There's a decade of code that has very little testing, still...
- jamescarr 15y agoYes I test drive my code to describe behavior and relationships between collaborators. I use my tests to validate my code and design, not to "catch bugs".
- gendoikari 15y agoYES, this is the point!
- ryaf 15y agoI love testing I just find using it in the right way can be very tricky sometimes. Especially in a team setting where there are weaker members than others. When you work with a team of people that didn't understand what to test you end up with really bad tests that add very little value. Do you delete those test? Write sane ones? When you end up with a legacy code base where doing something like functional UI testing is easy but doing unit testing on the actual code is almost impossible, do you even attempt to unit test it? If you see a piece of code with that must be rewritten, but unit testing it costs too much time, do you simply start writing tests what you think the assumptions were and then just go about with the rewrite? In the end I see a huge value in testing what you write, and being automated is preferred. My problem becomes picking up something else that was clearly done in a misguided fashion and reliably rewriting or refactoring it. I know there are probably some guides/books out there that demonstrate it so any suggestions are welcome.
- rjim86 15y agowe just started giving importance to it... :)
- oda1560 15y agoReal programmers don't test their code, QA does that for me, it comes back as defects later
- Tinned_Tuna 15y agoI really wish automated testing was significantly better for Java and the ilk. To steal from the Haskell world, I want to augment JUnit/TestNG with Small and QuickCheck. The tests would go something like this: 1: SmallCheck exhaustively tests the small cases 2: JUnit/TestNG tests the main use-cases. 3: QuickCheck produces a lot of random tests and hammers the APIs. Sadly (for Java at least) this appears to be a rather difficult ask.
- functionform 15y agoI chose tests all functionality, but thats completely unrealistic. We TRY to test everything beyond just critical items, but we'll never get there.
- deleted 15y ago[deleted]
- jmtame 15y agoEarly on, I asked most YC founders I met whether they did testing in the early days, and almost all of them said "no". I've also not written tests in the past simply because it's a time investment--why test if you could be working on something entirely different in a few weeks? Code can be very volatile in an early stage startup. Think it makes more sense the later stage your startup is where you're more certain of what exactly it is you're building.
- nagnatron 15y agoI honestly use tests more as a design tool than for testing functionality. After that you end up with a kind of a regression test suite. It's cool to try to use the API you're building before you build it.
- pbiggar 15y agoEven when you're prototyping, I find it useful to write one test. The gains from the first test are the biggest - pretty low investment, with reasonable returns. It won't be great, but it will provide some form of sanity checking when you work on other stuff. Of course, it informs the design, which is a very overlooked feature of testing. Lastly, it provides a foothold for more tests. When you're working on something hairy, there won't be any obstacle to "well, maybe I'll just add this one more test to save me some time".
- mattbriggs 15y agoIf you are throwing your code away every few weeks, it is probably wasted time. If your codebase is in a lot of flux, it will save you a ton of time, since a good test suite tells you what breaks every time you change something.
- andrew93101 15y agoThis is the right answer. If you are trying to really quickly get code in front of users, and are working through a lot of ideas that don't end up going anywhere (code that is eventually thrown away), then heavily tested code is probably not the best use of your time. Once you get a product with some traction, and are going to be working with a codebase for some time (especially a code base that will be growing), heavily tested code is invaluable. Example: Upgrading a large Rails app (~250k lines) from rails 2.3 to 3.0 in eight weeks. Having roughly a 1:1 code:test ratio allows us to be extremely nimble. It also allows developers to work in almost any area of the codebase with confidence. For apps that will be around for awhile and will be growing, a large test suite is indispensable.
- functionform 15y agoAfter reading this thread, I've realized I have to make sure my next employer actually believes in testing. I don't know how anyone can move forward in a long term application without having regressions done for you in the form of testing.
- pbiggar 15y agoWe actually made a company to do other people's testing: http://CircleCI.com http://CircleCI.com. Really easy Continuous Integration for web apps. Email paul@circleci.com for a beta invite. That said, I subscribe to the philosophy that testing is only there to support the business, not and end in itself. We often prototype features with no testing at all, because they get rewritten 3 times anyway. Often, writing the tests is what highlights flaws in our logic, so without it we would often we flying blind. Testing slows down coding by about 135% (yes, more than twice as slow), but makes that time back in spades when you have to work on the same code again, or when changing lower layers (models, libraries, etc).
- volandovengo 15y agoI think your definition of test is flawed. The majority of "testing" is just using your site to see if it is broken. You can write automation to pin point errors faster but it is not the way the majority of the world tests software.
- dlikhten 15y agoI think TDD at times is overkill, but the core components of any app that others stand on MUST BE TESTED. The deeper your component is, the more critical tests are. Because if code a few levels deep breaks, it is much harder to fix/detect than something on the surface, which is usually immediately visible, immediately obvious, and low risk fixing.
- pathorn 15y agoI don't usually test my code, but when I do... I do it in production. https://www.google.com/search?q=I+dont+usually+test+my+code https://www.google.com/search?q=I+dont+usually+test+my+code (Sorry for the obligatory meme reference)
- Jessematic 15y agoI test everything before I send it out. That's my rep on the line and I don't want to be known for faulty coding.
- rakeshks 15y agoWhat will tester do then?
- shrub 15y agoUnfortunately our sales people are obsessed with agreeing to whatever customers dictate in order to make a sale. The customer wants a full featured, fully customized, fully automated E-commerce solution and they want it for a flat $5000? Sold. Customer says "What is this 'testing' sh*t on the quote? It should just work the first time, or do you only have a Jr developer on staff who needs everything double checked for them? We can go some place more professional" and sales person replies "Oh yeah, that - you're right. Our developer is a wizard and I forgot to take that off." No matter how many times I explain or quote higher or tell them the feature creep is becoming unreasonable (oh by the way, we have 18 products with complicated interactions, not the 3 we asked for on the quote, but we expect to still pay the same), such that I can't possibly write it all and test it all, they just don't listen and they leave me holding the bag. So, while I'd like to do testing, just getting the thing kind-of working isn't in the budget, never mind getting it working well. Sorry for the rant and... come to think of it, it may be time for a new job.
- jdminhbg 15y agoI'm not a testing fanatic, but I do TDD. I don't put "testing" on the invoice any more than I would put "typing" or "refactoring." That's internal to my process of delivering quality software, and either you like my estimates/deliveries or you don't. But... it does sound like you need a new job.
- deleted 15y ago[deleted]
- pavelkaroukin 15y agoDo not include testing into bill. It is quite confusing for somebody outside of software development and I find their comments about jr. developers quite reasonable. Just put number of hours or amount to cover development and writing tests.
- brown9-2 15y agoI don't understand why you would include testing in the invoice separate from development. It makes it seem like an activity that could be eliminated if need be. But, are you really going to deliver code that you developed without testing it in some way? You might not be writing test code, but I'd bet you are still doing testing of some other kind.
- felixchan 15y agoEveryone says they do Unit Tests, but no one "really" does it.
- CptCodeMonkey 15y agoIn production; its good to involve your customers in the development process so they feel included. Seriously though, for small web projects I usually aim for 100% unit-test coverage on the models, 70-80% on controllers, and then depending on the application jasmine or selenium to verify the UI components are happy. For larger projects, add in more integration tests ( models -> controllers, controller -> views ) and on something like mechanize to do full stack tests ( models -> view ). Additionally for either small or large, running some sort of lint/static analysis at the CI can be beneficial.
- TimLangley 15y agoyes yes yes and yes again we're not obsessed about code coverage - but get disappointed when it falls below about 75% We've a code based which is a mixture of javascript MVC (Backbone) and PHP (Zend) A healthy attitude to unit testing and dev-ops has saved our back more times than I care to mention. Also - it's a very useful way to "train" new developers. Spending 2-3 weeks writing tests is a great way to get a feel for a) the code b) house style where new developers can be immediately productive - without risking touching production code on day 1
- ahi 15y agoI would need some sort of spec or at least a vague understanding of intended behavior before testing. A good day is a day my lead dev doesn't bork the repository.
- indianaCoder 15y agoSometimes we test, sometimes we let users test!! Either way...we find our bugs...
- indianaCoder 15y agoWe use a combination of user testing and developer testing...
- gargalatas 15y agoSometimes I think: Testing has not invented by a geek. Geeks don't test. Some other times I think: Testing is good. It gives quality.
- tmilewski 15y agoI Don't Always Test My Code, but when I Do, I Do It in Production. http://troll.me/i-dont-always-test-my-code-but-when-i-do-i-do-it-in-production/ http://troll.me/i-dont-always-test-my-code-but-when-i-do-i-d...
- tmilewski 15y agoJokes aside, I personally try to as much as possible.
- clickonchris 15y agoMissing option: I wish we did more testing but the organizational support does not exist. Also it's time to look for a new job.
- verelo 15y agoWe need to test more. I've run projects before that had over 1500 automated tests..mostly written by myself, it was beautiful and so simple to make invasive changes. We have a lot of catch up to do right now, but i think thats what "startups" often do. We will catch up with the tests in the next month or so, at the end of the day I know perfectly well that without them pivoting and making invasive changes will simply be next to impossible.
- anarchotroll 15y agoAnd how often did you have to rewrite those tests because you were drastically changing the architecture of your code? Do you think the effort of maintaining all those tests might not have paid off? This question is very tricky to answer.
- netzpirat 15y agoI do test almost anything in my apps and I can't imagine to write my software without it nowadays. I test my Ruby code in the backend, the CoffeeScript code in the frontend and I have integration tests to verify that the whole stack works fine. It took me a lot of effort to learn it properly, I have read many books about testing, have read the tests of plenty of open source software to see how others do it and I wrote thousands of wrong tests until I got at a stage where I can say I have mastered testing. I was always fascinated about test driven development, but to be honest, it does not work for me and I seldom do it. In most cases I normally write new functionality, then I describe the behavior of it and finally do some refactoring until the code quality meet my needs. When you can refactor a class without breaking a single test, you know you've done it right. It's important that you find your way and don't try to follow the rules from others. Take your time, mastering software testing is a complex discipline and it won't happen overnight. Even with a high level of test coverage, I always encounter new bugs when using the software. But after fixing it and adding some tests, I know at least that I will not see the exact same bug again. I believe that writing tests speeds up my development. This may seems illogical at first, but without the tests my development would slow down with increasing complexity (Lehman's Law), and instead of adding new functionality I'd find myself fixing old stuff. So testing allows me to manage a large and complex codebase, it allows me to do a complicated architectural refactoring and I know everything important still works as expected.
- imosquera 15y agoyes, we have integration + unit tests for everything that we do. before we release any code the entire suite gets executed and tested which helps catch bugs quickly. we even use a subset of those tests in production to make sure all sub-systems are working, not just a ping to the api.getsocialize.com domain which isn't sufficient. When I first started testing I was rather skeptical. But now that I do it, I wouldn't code without it. There are so many other benefits of testing like cleaner code, incremental builds for native apps, and just general confidence in your deployments that allows us to deploy anytime of the day without worry.
- gordonguthrie 15y agoWe try and do as much TTD as possible. Specification by test is the best way to drive out corner cases.
- pavelkaroukin 15y agoFor projects I am doing on my own (albeit, these are quite simple, just fun ones) I am doing TDD approach. It is really natural to me, because part of developing idea is a research. It often includes doing some test of how particular library works, what format of data expected, etc. I always was finding myself doing small isolated programs/scripts to test specific question I have about it. And now it was so natural to start using TDD approach. As other commenters noted, due migration of much logic to JS (client) side, testing it together with server app might be a challenge. For my particular case I "solved" it by using V8 library. I am developing with Perl language and there is great libraries available on cpan. V8 and pure Perl ones. I am using V8 for performance reasons (doing encryption), but before I used pure Perl JS library and it worked perfectly too. So if your language of choose have libraries to hook into one of JS libraries, I would highly recommend to try to include JS tests into application tests kit.
- njharman 15y agoThere's huge gap between all and few critical things. I expect many others fit in there.
- mdonahoe 15y agoA good dashboard is better than testing. Whenever I deploy new code, I make sure I pass all the unit tests, but then I watch the monitor the dashboard and incoming requests to confirm.
- fairramone 15y agoI don't always test my code, but when I do, I do it in production.
- jfmercer 15y ago"I don't always test my code, but when I do, I do it in production." http://i.qkme.me/22sv.jpg http://i.qkme.me/22sv.jpg
- redsymbol 15y agoI would have liked an intermediate option between "test all" and "test a few critical things". Pretty much we follow the 80/20 rule with unit and integration tests, and it's served me and different teammates well over years of software development.
- drsim 15y agoThis is the same philosophy I subscribe to. It's wasteful to test everything in a non-world-world-is-going-to-end system. Especially if you're running lean and the code may be thrown away in a week.
- joe_the_user 15y agoI do automated testing as much as I can, the main thing standing in my way is the problem of testing GUIs. GUI testing frameworks are inevitably painfully slow, don't test the appear of a GUI and don't test things like responsiveness and the varieties of behaviors of user message loop. I'd like to have the ability to test even more. That said, I think TDD is trendy-consultant-crap. Writing a test before your write the code only works for simplistic code that doesn't need much testing and probably won't produce the right test for your code once you have written the code. Also, for code I've just written, a ad-hoc manual test using the GUI is often much faster than writing a full test and I likely wouldn't ever need to run those tests again. The test suit takes quite a while to complete and if I could add every manual test I've ever run, it would take absolutely forever. Something like "Zen Test", which runs the relevant tests in the background on code being changed sounds good but I don't think there's anything like it for c++. I'm a bit doubtful it could work on complex code in any language. A lot of R-and-R magic sounds like its creators never went code involving one model method, one controller method and one view method.
- bytemask 15y agoI just want to say, it's always a nice feeling when I get all-green output from rspec and jenkins. The problem is that tests, like your code, are subject to the laws of entropy that comes from bit-rot. So, I test things that matter and don't change too often - core business logic. 100% test coverage is just a goal, a bar to aim for. And I'm totally with Zed Shaw when it comes to TDD - not worth it when you're still trying to get a full understanding of your problem domain.
- RoadRunner_23 15y agowe would, if management does not show tight schedules up our dev bottoms.
- X-Istence 15y agoWe run tests at Absio (the place I work). Everything is supposed to have full unit test coverage, but with ship-it mode that has slipped a little lately. When you commit to a personal clone of mainline and push it up to the server Jenkins picks it up, builds it, and runs the tests, and if there are any failures notifies you over Jabber and or email to let you know it is broken and for you to go look at it. We also integrate Jenkins with JIRA, so as soon as Jenkins builds something, pass/fail if there is a JIRA ID in the commit message a comment is automatically added there as well, which if people are watching the bugs they will get notified about. This effectively allows people to see how they are coming along in terms of their progress and lets them see when stuff is broken almost instantly. Automated builds are nice because we can distribute the builds across a variety of different environments at the same time to see that if maybe something worked on Mac OS X that it doesn't build on Linux, well that needs to be fixed. It definitely has made me code more defensively, nobody wants to have your Jenkins build show up as red on the status board, and nobody wants the extra scrutiny on code review when asking to merge something back into mainline. So far it has worked fairly well with most developers doing testing.
- einhverfr 15y agoFor LedgerSMB, one of the really critical problems we run into is that of the legacy codebase. We test some critical things, but the legacy codebase has scoping issues that don't impact normal use in a CGI environment but impact test cases. It's one reason we are getting rid of it. 90% of the testing we do is actually on the stored procedures and the general framework. The reasoning here is that these areas have to work right and therefore we have to get this right all the time. Workflow and the like is more fluid, less easily spec'd out, and the like. Test cases aren't as meaningful there but we do have some.
- sgonyea 15y agoWhere's the "We have a QA department" option? lulz
- Produce 15y agoIt's scary that so many programmers don't write automated tests when their entire profession is about abstraction and automation. If you want it to work, test it. If you want to maintain sanity, automate it. It's not particularly complicated.
- drobilla 15y agoI have some projects with extremely thorough test suites, and some projects with no automated testing at all. I find my desire to work on those projects directly proportional to test suite coverage. Once you start writing against automated tests, there's no going back...
- facundo_olano 15y agoYou forgot to put the option: "I know tests are great, I know I'll regret it, but I'm too lazy to write them".
- leif 15y agoMy company doesn't produce a website, but we run a large suite of tests nightly, and before every release.
- stevenbristol 15y agoWe are rearchitecting our code base to make testing easier/faster/better
- issa 15y agoMy company has a pretty complex system for testing. But almost all code that makes it into production is done with ridiculous deadlines that forces us to skip all of our testing. Ain't that life?
- laxk 15y agoI highly recommend this book "xUnit Test Patterns: Refactoring Test Code" (http://www.amazon.com/xUnit-Test-Patterns-Refactoring-Code/dp/0131495054 http://www.amazon.com/xUnit-Test-Patterns-Refactoring-Code/d...) to anyone who wants to start to use tests on daily basis.
- will_ 15y agoThe best type of test depends on the type of software being developed. For the sort of statistical software that I have been involved with, I think that system level tests (with synthetic and/or real data) give tremendous bang for the buck. This is particularly true if the data is high volume, relatively homogeneous (in some sense), and most of the top-level interfaces are fixed fairly early on. Many other projects are not like this, and so may benefit more (proportionally) from different approaches to testing.
- nhangen 15y agoWe test a lot, but would really like to hire a permanent QA tester because it's very easy to miss things when you see the same software every day.
- secoif 15y agoTesting isn't easy, but it's also a skill you get better at over time. You get a feel for what you should and should not test. You get quick at writing units. Toughen up. Learn to test, noobs. How can you refactor safely without tests? You can't. How can you safely upgrade your tools (which often change in subtle ways), without tests? You can't. "Every programmer knows they should write tests for their code. Few do. The universal response to "Why not?" is "I'm in too much of a hurry." This quickly becomes a vicious cycle- the more pressure you feel, the fewer tests you write. The fewer tests you write, the less productive you are and the less stable your code becomes. The less productive and accurate you are, the more pressure you feel. Programmers burn out from just such cycles. Breaking out requires an outside influence. We found the outside influence we needed in a simple testing framework that lets us do a little testing that makes a big difference." Quote from: http://junit.sourceforge.net/doc/testinfected/testing.htm http://junit.sourceforge.net/doc/testinfected/testing.htm
- phillijw 15y agoWe have QA that does testing
- buckwild 15y agoIn production ;-D Take the fortune 500 approach. It's not a bug unless customers complain.
- jrockway 15y agoWhy is there no "and also click" option for, "we are unhappy with the amount of testing we do, and are gradually adding more".
- jrockway 15y agoReally, downvoted? The survey seems predisposed to result in the conclusion that testing is a waste of time. My company finds it worthwhile enough that we are never happy with what we have. We could always write better tests, but we need more engineers than we can find to hire. So we are unhappy with the current situation, but are working to improve.
- edwardw 15y agoThis is against HN guideline[1]:"Resist complaining about being downmodded. It never does any good, and it makes boring reading." [1] http://ycombinator.com/newsguidelines.html http://ycombinator.com/newsguidelines.html
- IanMechura 15y agoI don't find an applicable selection for my company. We write and run so many tests that it is a full time job curating the test suites that should be run prior to code delivery. Basically, if you don;t like writing tests you will be miserable at our shop. The tricky part is keeping testing standards consistent when you get beyond 30 or 40 developers. Developers tend to be more opinionated about testing practices than even editor selection and curly brace placement.
- IanMechura 15y agoWOW! I must say that I am actually surprised how many people have replied that they do little or no testing. Perhaps this is because I am in the enterprise development world as opposed to the start-up world. The cost and frustration involved in delivering a critical bug into a QA or production environment is much higher than the cost and frustration of writing and maintaining tests. Every action in business has a cost associated with it. The more people involved (customers, UAT, Managers, etc.) the higher the cost. The sooner you can discover the bugs and fix them the less people are impacted the lower the cost. This is how you make yourself as a developer more valuable and justify your high salary/rate by ingraining habits into your daily routine that reduce costs for the business. In this I also imply non monetary costs, like the personal costs involved in asking a VP to sign off on an off-cycle production release due to a bug that could have been identified by a test prior to the integration build.
- xarien 15y agoEverything through unit tests All important features through functional tests All critical path features through endurance tests Ad Hoc + user feedback for the rest
- ori_b 15y agoTesting is great, but I find that a set of full-system tests tend to give the most bang for the buck if you can make them run quickly enough.
- winter_blue 15y agoIsn't actually running your program and checking if it works a form of testing? The term "test suite" seems to refer to formal testing techniques like creating unit tests and the like. I don't do that. But I do test my program on every functionality by running and checking if it does what it's supposed to do. Does that qualify as testing?
- songco 15y agoabout 80% of the line coverage.
- singingfish 15y agoWe have a test suite that checks for as much stuff as we can but our application is really rather complicated, and to test it fully we would need a full time test engineer.
- sateesh 15y agoOne other beneficial side effects of having an automated test suite is that they come in handy during any profiling one need to do against the code base. Trigger the automated test suite from the profiler and analyze its output to any performance bottlenecks in the codebase. Also the practice and triggering the of automated tests regularly (continuous integration) and tracking the time it takes for the tests to run helps to detect early in the development cycle if any of the changes made were suboptimal. All environmental factors being equal a new small feature implemented shouldn't drastically increase the time it takes to run the test suite.
- mukaiji 15y agoPinterest #FTW : http://news.ycombinator.com/item?id=3541317 http://news.ycombinator.com/item?id=3541317
- gendoikari 15y agoOMG! Only 773 programmers O_o
- deleted 15y ago[deleted]
- fatihdonmez 15y agotesting is cool when you do it so we decide to not do it.. it's push you to code better with pain in the ass :)
- sbarlster 15y agoUnit tests. Tick. Integration tests. Tick Automated acceptance tests. No Tick. Tried to sell concordian as a framework to support BDD - but that is a hard x-discipline change which would have required more effort to push through. So as a short term measure have started to write/express unit tests using a standard BDD style - GIVEN x WHEN y SHOULD z. This has helped to assign value to each unit test. There is now a direct connection between the test name and acceptance criteria specified in a user story.
- sigzero 15y agoYes, it's called "user tests". lol Just kidding, we have a test suite that tests the things deemed critical and some other stuff.
- tolitius 15y agothe answer to "how much" is aways "it depends". * tech stacks evolve changing the amount of testing that is needed => most of the stacks allow to only focus on the "meat" of the logic, rather than things like integration (Spring Integration / Camel), network (Netty), cache (Redis) or even data structures (various language built ins). * human is getting better with years of coding => I spot flaws and mistakes during code reviews N times faster than I did 10 years ago. I code in little pieces (usually functions), which "talk" back to me immediately even before they are finished. * REPL is getting really good => Clojure, Scala, Ruby, Groovy, etc.. REPLs save lots of time and prevents mistakes: where a 5 minutes REPLay session reveals a nice and polished approach a lot quicker than a "let's try this / now rerun the test" formula. * Domain knowledge and "'ve done this exact thing before" greatly impact amount of testing needed => e.g. deeper domain knowledge allows for [better] tests, while no domain knowledge requires lots of prototyping (even if you think it is the "real thing" at first, it is not, it's a prototype), and would greatly suffer from a large number of tests, as most of the time will be spent rewriting test instead of learning the domain. In the end, the rule of thumb I always use is "do whatever makes sense". I don't buy TDD, ADD and other DDs. They are fun to read about, but they are too removed from the "real thing". If any DD term is needed, what I use is MSDD => "Making Sense Driven Development"
- squozzer 15y agoWe test our code in battle...er, production...
- badboyblue1 15y agoNot like we should
- rezna 15y agoI answered "We'd like to do more testing but it's too much overhead" but it's not really true. The true answer would be "We'd like to do more testing but it's hard to convince people to really write tests."
- rwaldron 15y agoThis year, my motto is: "Tests or it doesn't exist" - don't use any code that isn't tested or the author is unwilling to accept contributed tests.
- misterhaywood 15y agoI always test my code. It saves time and money. http://hustletips.tumblr.com/post/19348536703/vet-your-work-you-will-save-time-money http://hustletips.tumblr.com/post/19348536703/vet-your-work-...
- aduric 15y agoNot only does testing help with managing large codebases by being able to make actual assertions about certain parts of the code (to be able to prove correctness) but it also improves the quality of your code. If you're writing code that must pass certain tests, you inherently start to think about making that code more modular and de-coupled, ie injecting dependencies rather than creating them for a start.
- peelle 15y agoI think there should be a option between the top two. "We have a test suite that tests most things" That's where our dev team is really at.
- ravin455 15y agoEvery single line of code...
- ravin455 15y agoEvery single line of code...
- denysonique 15y agoTesting is ideal for established business. Testing is inefficient for some early stage startups which very often change the way their product works (features/ui).
- anarchotroll 15y agoBottom line is: test code is code and you have to maintain it. If you write code that does not give you anything in return, or gives you more headaches than anything else, you wasted your time when you wrote it. When you are writing any code, you should try to predict if what you will gain out of it will be worth it. In other words: evaluate the risks of anything you do in your life.
- anarchotroll 15y agoYou shouldn't be proud of having 1 gazillion tests if all you do is rewrite/fix regressions on them.
- 16s 15y agoI do simple output and performance testing. I md5 the output produced by our programs and test their run time, memory use, etc. so that when we change the code, we can verify the output is the same and performance is still OK. I try to do some unit testing too, but do not have time to do that as much as I'd like.
- codereview 15y agoTesting is a pain and it takes time. Plus, we don't always even find the bugs. But if you write unit tests or want to start unit testing, Typemock's newest release (released last Monday) makes unit testing easy and finds the bugs for you. http://www.typemock.com http://www.typemock.com