Test-driven development plays a very important role in DevOps. The Wikipedia definition (https://en.wikipedia.org/wiki/Test-driven_development) of test-driven development is this:
"A software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved to pass the new tests, only."
By knowing your requirements so well that you can write test cases that accurately reflect those requirements, you automatically write fitting code. This is usually done by developing solid test cases first that test the so-called happy path. All code is then developed so that the test cases pass.
The benefit of this approach is that no unnecessary code is produced, since the code only needs to satisfy the requirements. TDD also leads to modularization of the...