Self-testing Code is an important feature of DevOps culture. In DevOps culture, development team members are expected to write self-testing code. It means we have to write code along with the tests that can test this code. Once the test passes, we feel confident to release the code.
If we get an issue in production, we first write an automation test to validate that the issue happens in the current release. Once the issue in the release code is fixed, we run the same test to validate that the defect is not there. With each release, we keep running the tests so that the issue does not appear anymore.
One of the techniques of writing Self-testing code is Test DrivenDevelopment (TDD).