3 ms·
I have seen this opinion many times, in real life and online. I would say that if you have no users then yes, tests are optional. However, once you have users t
by ser0 10y ago
I have seen this opinion many times, in real life and online. I would say that if you have no users then yes, tests are optional. However, once you have users that have certain expectations about how the system behaves, then you need automated tests to at least do your regression tests for you.
In terms of unit tests, the audience stops being the users, and starts being other developers. Good unit tests should do more than just check that a function/method works as expected, but provide a list of examples of how to use a method as well as noting the return types/exceptions/etc for other developers.
Using the author's example that even after writing Selenium tests the application is still buggy. There are several issues in just this one example:
1. The application may be buggy, but did the business know about the bugs?
2. If the business knew about the bugs, did users work around the problems or did they avoid certain features altogether?
3. When the UI changes, yes, your Selenium tests may be expected to break. If a user expects to click "Next" and you changed that label to be ">", the test breaking is a sign you need to communicate something to the user either through change-logs or training.
At the end of the day, tests exercise and lock down behaviour of code. Whether behaviour and functionality is desirable, correct, or worth locking down is not a technical problem. Furthermore, your tests themselves are code, therefore some care must be taken to ensure your tests are valid too.
- itamarst 10y agoYou say "At the end of the day, tests exercise and lock down behaviour of code." That's exactly why tests can be expensive! If your UI is changing rapidly the tests try to lock things down when they shouldn't be locked down. Sometimes you want stability. Testing for stability is worth doing then. Sometimes you can't have stability, and automated tests are just an expense. It all depends on situation and goals.