This was the hard question for my team when getting an automation project which is implemented by the old team. So we do many things to make it stable and maintainable.
- Define Definition of Done (DOD) when scripting a new test cases
- Define Coding Convention and follow strictly: comment hard methods, naming, methods…
- Refactor code: the good structure will be easy to maintain… (there are so many things in this step to make the framework and the test scripts be maintainable)
- Weekly code review
- Cross review code section
And there will be some more steps, they will depend on the project, the framework and the client in many cases