4 ms·
One thing I would add to this is start writing tests from the get go. Any language you're writing in offers a lengua-franca Testing frameworks, NUnit, Gotest, R
by sergiotapia 13y ago
One thing I would add to this is start writing tests from the get go. Any language you're writing in offers a lengua-franca Testing frameworks, NUnit, Gotest, RSpec, PHPUnit etc - just do it now.
Much later down the line when you start finding harder bugs you wish your basics were tested and verified. It's _priceless_ to run your test suite and make sure everything is kosher after a change. This is something that took me years to put into motion with my projects despite reading about it online.
Set up a build server on your own VPS or something like https://www.codeship.io/ https://www.codeship.io/ and have it hook into every commit and run your test suite, if all green, deploy to production. Saves time, thus saves money.
- randall 13y agoWe added test suites after we were making money / people had to rely on our software. I think doing it before is kind of a waste of time... because who cares about well tested unused software. I'd say add them in after you have enough to pay one person full-time.
- mkilling 13y agoI agree with randall. Tests ensure that you build your software right, as opposed to building the right software. A large test suite impedes how fast you can deliver new features. We wrote tests for PlaytestCloud only after we acquired the first paying customers. The tests only ensured that customer-facing routes would not crash. It was a good balance to ensure that we could move quickly while ensuring that we didn't introduce catastrophic bugs.
- conorgil145 13y agoPutting off testing until you show traction can be a slippery slope. Writing tests early on can have many benefits including: better architecture/design, confidence the code performs as expected, regression testing when adding new features, ability to more quickly add new features because of the good design, etc. If the person in charge is the stereotypical "business type", then it can be difficult/impossible to convince him/her to allow engineers to spend time doing a refactor and/or writing tests for code which was written months ago and is "working fine" because you now are showing some traction. This can easily lead to never actually getting around to writing that robust and practical test suite that is really necessary in the long term. Note that I also say the test suite should be practical (for some definition of practical which may vary from engineer to engineer). For example, 100% test coverage may not be useful, determine which parts of the code MUST be tested and which parts are just diminishing returns, etc, etc.
- subsection1h 13y ago> If the person in charge is the stereotypical "business type", then it can be difficult/impossible to convince him/her to allow engineers to spend time doing a refactor and/or writing tests for code which was written months ago and is "working fine" because you now are showing some traction. What I've done on a couple of occasions was to tell the nontechnical stakeholders that automated tests must be added before the web app framework (or whatever significant dependency) could be upgraded. In the context of such an upgrade, they could understand the benefit of a test suite, and they signed off on it.
- troels 13y agoI have to agree with that. Tests are an investment in QA. Prioritising that before you have a product-market-fit is probably the wrong priority (Of course, depending on the specific scenario). A lot of thought leaders have been promoting testing like crazy the last couple of years, with the result that some people treat it like it's essential, when it rarely is.
- ma2rten 13y agoIt depends. There are 4 situations I can think of where writing tests is essential: - mission critical code - before refactoring - people working on a codebase they don't understand completely (changing X might break Y) - implementing complicated algorithms In other situations, it's a almost a matter of taste: There are people who claim that writing tests will actually make you develop faster because you'll spend less time debugging. Also writing unit tests sometimes can make you think more systematic about all the edge cases an api needs to support.
- pkorzeniewski 13y agoSo much this - in the past I was very stubborn when it came to writing tests, I was like "meh, why waste time on writing tests when I can write new functionalities in that time?". Now, I'm quite the opposite - whenever I add new functionality, I write as much tests as possible - it makes life so much easier in the future. Yes, sometimes it can be irritating when you change one line in your code and you have to fix 10 tests, but the peace of mind when all tests run successfully after each change in code is priceless.
- iaskwhy 13y agoThe key thing here is "in the past I was very stubborn when it came to x". This probably happens with most people so think about why you were stubborn about x in the first place and why it was the wrong choice to maintain that opinion until you finally changed it.
- williamcotton 13y agoThe amount of time saved depends on a number of factors. Writing a test suite before you know what your product even does can be counter-productive. I never write tests until something is launched and it looks like anyone will be using it. There's no need to have test coverage for software that's going to be completely torn to shreds every couple of weeks until that first spark lights in the eyes of a user who finds the value proposition you've been searching for. Unless you have the luxury of working with a full team and have plenty of time to kill (read: money to burn) you're going to want to cut as many corners as possible. If it is a fast moving new market it could save valuable weeks to skip out on a number of 'best practices'. You would be astonished at the number of products launched without a stitch of what would pass muster on a more mature code base. The goal is to find something that people want, not to make robust software. That comes later. Pretending like there aren't up front costs to writing and maintaining tests is absurd. You'll also find that if you're sticking to functional and stateless design patterns that your code is incredibly easy to reason about. Ditch the OO patterns like observers... Anything where new instances of objects are created, anything where you can't literally serialize the state of your running application, restart it, and get back the entire state you were just in... People tell me that tests force people to reason about their code in such a manner. I think that reasoning about your code in such a manner is the really important part. You end up with code that you never need to step through or pry apart in a REPL. It just works (TM). I dunno, I've been writing application code for almost 20 years now. I've learned from a lot of architectural and implementation mistakes I've made over the years. State and side effects are the fucking enemy. All of the testing in the world isn't going to fix your ill conceived understanding of whatever new problem space you're dealing with. I also find tests make the most sense when there are multiple developers working on a code base. A single dev isn't going to benefit as much from the cost. And yes, again, tests do have a cost. It is absolutely ridiculous to argue that they don't. And ditch the objects. They make no sense outside of a Smalltalk or Self environment. After you launch and people are using it, after you've got a few developers working in the code base, after the product has actually stabilized to a set of more or less concrete specifications, THEN write your tests. If it really is the frontier then cowboy coding is just fine. :) The west wasn't won with prudence, it was won by taking risks and moving quickly. You're not the only guy with dreams of building that railroad. Someone else is already driving stakes in to the ground. You can go back and build a better bridge, a more efficient path through that valley, or a safer incline AFTER the line links up. The intercontinental railroad was a mess for decades after it was built but that didn't matter because the utility provided was immeasurable. If you're just building another commuter rail in a busy town, well then I can't relate at all. Use your TDD mumbo jumbo. I'm a start up guy, I'm a cowboy, ON A STEEL HORSE I RIDE. AND I'M WANTED, DEAD OR ALIVE. BTW, I have plenty of start up friends who successfully start new projects with tests. I mainly wrote this because I wanted to quote Jon Bob Jovi at the end there. :P
- dk8996 13y agoWe have been using codeship for about 4 - 5 months and we are really happy with it. The guys do a nice job. Moreover, they spin up DB instances that can handle our integration tests. It really has been a time saver -- not having to maintain our own CI server.
- sergiotapia 13y agoI know right? If you use it for more than an hour it's paying for itself easily.