2

Should I invest more time into automated testing?

Profile picture
Software Engineering Intern at Taro Community6 months ago

At the startup I’m currently interning at, there are no automated tests. Miraculously the entire system works. The codebase is small - my guess is around 50K LOC (they manually test everything). Since the engineering culture is pretty free flow, I’ve been able to set up unit and integration tests for code that I write from scratch (eg I can unit test classes I write, etc). I’d say I’ve written about 2000 - 2500 lines since starting in early June with a 60-40 split between code and unit tests. My company doesn’t do diff stacking, but I’d imagine I’d have 3-4 diffs based on the coding velocity course.

However, I’m having a bunch of trouble when I’m starting to integrate my code into production. I get a bunch of nasty linker errors (I work in C++) that require some workarounds and a lot of digging. As a result I’ve had to spend 2-3 days with these errors.

My gut feel is that these errors will continue to pop up as I continue coding, so should I just stop setting up automated tests and just manually verify, or is setting up tests worth the long term payoff? Since I’m interning every second matters.

69
5

Discussion

(5 comments)
  • 2
    Profile picture
    Eng @ Taro
    6 months ago

    If there isn't a testing framework set up yet, it's probably not worth it for you to set one up right now. I agree with Rahul about focusing on development velocity as an intern. There will be a lot of discussions between multiple teams if you want to implement a testing framework that every team can adopt.

    But, I do think there is a point where companies do need to adopt some automated testing when the number of engineers increases, the frequency of incidents increases, and incidents become more costly. You'll know when this point comes because it feels like you are always taking a step back with every commit, and you can make no forward progress because you're constantly fighting fires.

  • 1
    Profile picture
    Tech Lead/Manager at Meta, Pinterest, Kosei
    6 months ago

    I strongly suggest that you don't add automated tests.

    You're running into issues while integrating your code into production. Can you solve this simply by integrating the code more frequently? (even every day) You could do automated testing, but that seems like overkill. It could also be a waste of time, and as you say, every second matters in an internship.

    To add a bit more nuance:

    • You mention that the startup has no automated tests. Changing the culture of an engineering team is hard, and doubly so if you're an intern. Since creating a testing culture is such a big change, I would not even attempt it unless you get buy-in from the broader team.
    • Even if you were to add tests, I'm guessing there will be additional work to integrate it into some sort of continuous build/integration system, right? This is tangential to your main work, so I don't want you to waste time on it. Interns don't have the luxury to go down rabbit holes unless they finish their main project incredibly fast.

    Charlie's answer here about the thought process to decide between automated vs manual test is applicable here, I highly recommend going through it: Automated vs manual UI testing?

    Finally, wanted to say that your code output, in a vacuum, sounds great! Landing the equivalent of 3-4 diffs per week is solid, as talked about in the intern course. Just make sure you're in sync with your manager with questions like this:

    Relative to where you expected me to be at this point in the internship, how far along am I?

  • 1
    Profile picture
    Tech Lead @ Robinhood, Meta, Course Hero
    6 months ago

    Given that your company is so small (50k LOC really isn't a lot) and you're an intern, I highly recommend not writing automated tests.

    Look, automated tests are great, but they're not magic and they're not free. Test suites need to be diligently maintained, and they take a lot of work to set up properly to begin with (I've generally seen that engineers don't have these instincts until they're senior minimum, ideally staff).

    The big problem with tests is that they can become flaky, and a flaky test is way worse than not having a test at all. If you work at a fast-moving startup, your tests will become flaky very fast, and this could lead to you looking bad as your tests are generating a lot of annoying noise.

    Of course, I don't have all the pieces (there are indeed some 50k LOC codebases that should have tests), but in a vacuum, I recommend also testing things manually (do it elegantly as I talk about in the test plan lesson) and focusing on pushing more features to production.

    If you are interested in what it takes to set up a truly good automated test suite though, check this out: "What do mobile testing strategies look like at top tech companies?"

  • 1
    Profile picture
    Software Engineering Intern [OP]
    Taro Community
    6 months ago

    Thank you all for the feedback! I implemented your suggestions and here are a few updates:

    1. I miscounted the LOC by quite a lot - I have around 800K LOC, not including a GUI which may be around 20-40 LOC
    2. I focused on manual testing as opposed to setting up unit tests and I finished the first milestone of my project.
    3. I also asked my manager (and my other teammates) how I'm doing and they're pretty satisfied with my performance and my progress

    So all in all it seems that I'm in a good spot - just need to keep pushing to finish my project ASAP

    • 0
      Profile picture
      Tech Lead @ Robinhood, Meta, Course Hero
      6 months ago

      That's awesome - Thanks for the update!