TDD, new pattern for development ??
Jest - The testing fixtures

TDD, new pattern for development ??

Start of a new era

While the new era of developers starting to come and join the IT world, they already doesn't know the basic concepts of software development (I'm not targeting anyone FYI). As for example if someone asks a new dev who is new to this web dev world that do you know a server side language ? His answer would be no and its pretty obvious.

But as we everyone started to hear about DevOps and how this is so popular among developers now a days is a new way to attract new students who are already struggling to learn web dev or any other development in to this COURSE SELLING youtube marketing.


What's the relation with TDD ????

Yeah there is a relation with TDD aka Test Driven Development. As everyone is starting to lean towards into devops theres is the main concept called CI CD aka Continuous Integration and Continuous Development / Deployment, where we need to enforce software testing and other things such as code formatting code linting which is pretty childish for a solo developer who is new to development world. And it is pretty obvious because he might not get the chance to work with a real team of devs. And on the other hand where this is the main rule of devops to connect the development team with the operations team (no its not that simple its just for the newbies to understand). So he might start thinking about the process how he develops the softwares till that date and how an actual tech company does the same thing.


TDD the showstopper

So here comes the TDD part where the newbies wanna and might learn this. This is a way to develop applications and softwares where we write the test cases before actually coding the software. This enforces us to write clean and bug free code for which our code always pass the tests before shipping to production build. This also takes the pressure from a new DevOps engineer where he might know from where his CI CD pipeline broke or a simple buggy code breaks the whole workflow. This is not the fault of both of them, not the developer who wrote the code nor the devops engineer who pulled the tests into the ci pipelines to be passed.


How I integrated those test into my CI Pipeline

So basically i built a small and simple workflow with github actions inside my current project which is made with nextjs@14

So the ci pipeline is divided into two main workflows and each of them has composite actions inside them. Basically the testing and linting action is the main composite action to enforce the DRY principle because its common in both the production and development environments.

  • The first one is only for the deployment and checking vulnerable code by linting and testing them before building that into a single dockerfile and pusing it to docker hub container registry. It will only trigger when a code push happens directly to the master branch or a pull request is merged into the master branch and everyting inside this pipeline will be done inside the production environment.

This is the main workflow for the master branch


This is the composite action with which the docker image will be bult and pushed

  • The second one is a simple ci pipeline which is basically for only testing formatting and linting the code pushed to branches named as `dev-*` or `staging-*` i.e dev-bug-fix or staging-dockerfile or something else. Everything inside this will be done inside the build environment.


This is the main workflow

And the testing actions is the same as the production one.


Takeaways

Although there are more good and stable notes about TDD but its not a technical note about that and im not telling anyone that how this will work it is just a blog for a newbie. I think from scaring the test runs and test cases we should enforce the writing tests wo that every SDLC can be streamlined.

要查看或添加评论,请登录

Piush Bose的更多文章

  • Kafka for Dummies ??

    Kafka for Dummies ??

    Nowadays in the hurry of learning more and more things led people choose the wrong path or wrong way to learn things…

    4 条评论
  • Demystifying Kubernetes ????

    Demystifying Kubernetes ????

    DevOps Chronicles: Mastering Kubernetes with Minikube ?? Welcome back to my DevOps journey! This week, I've taken a…

  • The good first CI pipeline.

    The good first CI pipeline.

    The #week3 of learning #devops for me was quite intuitive. It was quite interesting also, to learn more about various…

    2 条评论

社区洞察

其他会员也浏览了