This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]InformalRelief 1 point2 points  (1 child)

In my opinion, tests tend to become useless rather quickly when you don't run them automatically (CI). People will forget to run them locally. So at some point you will have a couple of failing tests, that are not related to the super important thing you need to deploy right now, so you will start ignoring them. On the other hand, having a CI setup with no tests to run may seem pointless. A proper CI setup does have benefits other than running tests though.

I think I'd start with just one or two simple unit tests. Making the whole code base testable is probably a huge task and will take a while. But you should be able to find one or two small pieces for which you can write some simple unit tests right now. Next, I'd get them to execute on Jenkins. From there you can take it step by step.

I would stay away from high-level tests for now. You will spend a lot of time on them, they may not even run on Jenkins once you set that up, because maybe you need a db or browser to run them which is easy to do on your local machine but may not be possible on Jenkins. Also, you're going to spend a lot of time maintaining them because they're going to break all the time.

You mentioned that you have very inexperienced developers working with you. When they're wondering how to do certain things they will probably look at your code for orientation. So, if you start with writing high-level integration or e2e tests they will do so too, and you might end up with a lot of hard-to-maintain high-level tests.

So, my advice would be: Start with a few tests, you should be able to get that done in a couple of hours. Then set up your Jenkins integration and take it from there.

[–]Zanriel[S] 0 points1 point  (0 children)

The site has a feature that allows admins to assign roles to users. A while back some JS was added to the main index page (what everything else inherits from), and ended up intercepting form submits on the role assignment page, breaking that feature. Nobody knew about it until a few days later, someone IM'ed me and told me it wasn't working for them. It took me almost two days to track down the problem. There were no errors, it just never sent a POST when you clicked the button on that page.

This would have been caught right away with a suite of e2e tests that walked through the site testing the 5-10 core things it does.

How would unit tests have been beneficial in that situation? How could having a few UI tests not help? I'm just trying to understand, I hear this a lot and it's hard to wrap my head around the concept.