4
Nmeri17
6d

That time you would have used to test that code in postman, bravely muster the werewithal to write automated tests instead. It's a onetime investment that keeps malfunction in check until code is altered

I acknowledge the fact that it's not always possible. You may have gotten thrown in headfirst into unfamiliar territory ie tech stack, or inherit a monolith where no tests were pioneered. Or you may be strongly constrained for time. But in events that you can, it's worthwhile

Whether automated or manual, Testing your work the least professional thing to do before handover. Might as well swallow the bitter pill of avoiding the gui shortcut, and write those certifications once and get it over with

My preference is to write a boilerplate that gets generated each time I create a new module/resource management classes. Another strategy is to write them immediately after completing implementation of each endpoint/user story/feature, even if they're not run immediately. That way, they don't pile up in the end

Or you could try the tdd that everyone else cherishes. Whatever works for you, the end justifies the means

Comments
  • 1
    You don't have automatic roll back on failure? Testing in prod is so hot right now

    For me, it tends to be for code that I'm unsure about/would take too much setup to test manually OR a bug report from the user (that isn't a minor fix like a typo)

    The biggest value I've found is in groups where not everyone is as familiar with all the systems/incompetent, or you're going to be taking large gaps of work and need to be able to see how things should work
  • 2
    That kinda boiler plate is so good to do with AI. I have made an application that refactor's all my code to better practices / fixes typos / add MIT license and my emailaddres on top of file and does a small document description. See https://molodetz.nl/retoor/... for example.

    You could describe your default tests and prompt something like "I want the tests that i described for this piece of code". Fine -> will generate it. And if it's ok, you create an app of it that does purely that and saves the files automatically or so.

    I can deploy my server with AI now :D
  • 0
    @retoor Yep, for some work PRs I need to create some tests because of the holy coverage. I think I'm literally going to pass it to copilot and tell it to make tests
Add Comment