Imagine you’re writing a front end and that the backend that will be serving the data is not ready yet, or it’s down for whatever reason, but you know how the data will look like. In that case you can write a test with hardcoded data as if it’s coming from the actual backend, and test several possible cases of the front end logic.
Another example is this: say you have some functionality that’s behind some UI that you have to click through; you make a change, the page refreshes and you have to click a bunch of stuff again - until the next change when the page refreshes again. If you have to do this over and over again, things get inefficient. Instead, you can write a test to make sure the functionality handles the data properly and only then go through the UI to maybe test this or that edge case.
Plenty of other examples, but yeah, depending on what you’re doing, you might not need tests at all.
Imagine you’re writing a front end and that the backend that will be serving the data is not ready yet, or it’s down for whatever reason, but you know how the data will look like. In that case you can write a test with hardcoded data as if it’s coming from the actual backend, and test several possible cases of the front end logic.
Another example is this: say you have some functionality that’s behind some UI that you have to click through; you make a change, the page refreshes and you have to click a bunch of stuff again - until the next change when the page refreshes again. If you have to do this over and over again, things get inefficient. Instead, you can write a test to make sure the functionality handles the data properly and only then go through the UI to maybe test this or that edge case.
Plenty of other examples, but yeah, depending on what you’re doing, you might not need tests at all.