You probably know MVC. How about MCT?
Model–view–controller is commonly used for developing software that divides an application into three interconnected parts. This is done to separate internal representations of information from the ways information is presented to and accepted from the user. The MVC design pattern decouples these major components allowing for efficient code reuse and parallel development.
In order to take advantage of the benefits MVC provides, you need to implement this clear separation of concerns in your test framework as well. This article describes an approach to test automation inspired by a known development design pattern; that being Model Controller Testsuite (MCT) and describes how it can be adapted to make your automation code more stable and maintainable.