Ask HN: Founders, how much automated tests do you write?
For startup founders looking for market fit, or up to Series A/bootstrapped and growing, how often do you (or your team) write automated testing?
How do you go about it? Full coverage? End to end only? Integration only? How much dev time does it end up taking you?
41 comments
[ 3.3 ms ] story [ 82.1 ms ] threadThe goal is to have the major functionality of the platform tested automatically so we can be confident that new features don’t introduce new bugs.
Usually this is the practice I have seen successful in all the big projects
- unit test for each function
- Functional Integration test to test the building blocks and functions together (for example rest API with business layer and database
- BDD Behavior driven development where you write automated test to test your business scenarios by initializing the seed data in the test systems
- Performance testing
If you have freelancer who charge per hour or if you have consultants which are expensive - they will write too many test and there code will be so complex in the end that when you want to hire permanent employees or other freelancers they will say "I would like to rewrite it"
The developers now a days like to do clean coding and for simple things they discuss too much even for a program of 2 + 2. there will be endless discussions and in some companies (diverse or multi culture) developers are always under mining each other with what they like and don't like
Use TDD for bits that have very limited scope and function. For instance, an order book class or similar. Otherwise code first, test bugs if needed. For smaller projects (that aren't critical espc.) overtesting can kill your momentum and motivation, which is an often overlooked resource.
No, risk-based.
I guess it really depends on what your company is doing, experience of the team and the language/tech you are using.
somewhat political perspective: if the org doesn't value testing or software quality, wait until there's obviously a business need to lift quality. E.g. the CTO is saying things such as "constant defects in component X are destroying most of the value of our product", users complain that the Y feature keeps getting broken in successive releases, customers refuse to renew subscriptions or upgrade to a new version until Y feature works reliably. Then propose the plan to improve QA by setting up an automated regression test suite, to allow refactor-to-test of the offending code to happen in a controlled, low risk way.
That said at my last company after 12 months we hired a few engineers so we had to transition to requiring tests for new functionality. This was just to stop regressions and make sure we could continue moving quickly.
But for self contained code that is guaranteed to have edge cases (working with dates, date math, unstructured user input like SMS responses, almost always yes, but after some of the code is written and is getting cumbersome to test different cases manually.
For the frontend we do automated ui tests with a service called Autify.
This is not by any means extensive, BUT with very little time investment we get catch most of our bugs.
Ghost Inspector used to be my go to, but I’ve been looking for something in the $20-30 per month range. Makes it a much easier decision when we aren’t yet collecting much revenue.
The answers here are all correct for the use case of the person answering it. We don't know your use case so we can't give you a good answer.
For example a seed funded health tech company needs 100% test coverage to be compliant with regulations.
A bootstrapped online collaboration tool with no users doesn't need any tests.
A seed funded online collaboration tool needs some tests so the developers can work together without breaking each others code.
I generally write as little code as possible overall, and try to sell it as fast as possible.
I hate source code, it never ever is the result for me. So if i do not have to write code than I get to not write tests.
My goal is always to write as little code as absolutely possible. That's it
I mean how does it even works ? What if you want to build an app for a company which is wishing for digitization of their business - you need to have code - Don't you ?
Secondly how come founder are not liability - I have seen a stage in start ups when it comes to the situation where startup is either sold or purchased by other competitive business and after some months when the startup is absorbed the founders are gone or have a silent positions... Doesn't it make them liability afterwards?
Firmware is mostly tested manually.
Tiny mistakes that I make are caught early on, and development gets a solid foundation in which to build the proper abstract syntax tree.
Oh, test code is about 1/4th the size of the original source code, line-wise, but it has 100% coverage on syntax linkage (and not necessarily 100% data value validation due to dependency on other field settings).
source: https://github.com/egberts/bind9_parser
Well, unit tests are fine and often we do it for things like testing that email parsers and unit conversion works. As long as it's easier than manual testing.
It's also easier to do tests than debug sometimes.
Back end is a different story - the ROI on tests increases drastically because tests are easier to write and failure is more expensive.
I decided tests are a good thing to have, and especially when already set up and you can easily add more by following the pattern.
I prefer unit tests that are narrow in scope and avoid IO interactions (for example databases)
Of course anyone using my framework can ignore the tests if they desire. But my gut feeling is tests save you time in the short run as well as long run.
[0] https://github.com/mcapodici/firestarter