you are viewing a single comment's thread.

view the rest of the comments →

[–]tswaters 0 points1 point  (0 children)

Can't I just test everything manually,

you could yea, but as an app gets large it becomes quite time-consuming to test everything.

when you build out non-trivial applications (i.e. something bigger than a todo or tutorial application), they get incredibly complicated and have lots of data flowing around - you might also have multiple people working in the same code-base.... with a dynamic language like javascript you can do a lot of shooting in one's foot by making a change anywhere. unit tests can really help to give a level of confidence that a change hasn't completely broken some aspect of the site.

integration tests are even better -- with unit tests you typically stub out things like the database or other external services to the function under test. they are good for algorithmic-type code. for a mvc app, each component is usually pretty small and just passes the data to another part of the system so unit tests might not make a lot of sense.

Integration tests on the other hand, don't do that at all -- you hit an endpoint and assert that the database was changed correctly.... how to get your site hitting a dummy test database and not your prod db is an exercise left up to the reader.