I am really struggling to include proper testing practices into my code and would appreciate any advice on how to get going. I work in web dev so my I am interested in how to properly implement a suite of tests for websites and incorporate into it a CI/CD pipeline.

I find a lot of tutorials teach the most basic types of unit tests, 90% of the time most instructors teach how to write a test to sum two numbers, but when it comes to writing real unit test I find it hard to know what I should be testing. I learnt some cypress and have gotten better at including end-to-end testing because that makes more sense to me, but I still feel I am way short of where I should be.

How can I move forward? Did anyone else find themselves in my situation and find good resources to help them learn? Thx

  • lmaydev@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    4 months ago

    100% this.

    The majority of the times if you are struggling with unit tests it’s because your code isn’t testable.

    It felt weird at first writing code with tests in mind but, as you say, it makes your code much nicer to consume in the long run.