In this post, I share important test automation framework design guidelines that helps you develop test automation project with better test coverage and less maintenance effort.
Design Principle 1: Test Configuration
Configurable items like Application Url, Username, Password, Browser type, Secret key, Driver.exe path should be kept in an external file. This will make sure while you change any configuration there should be minimum effort involved.
Design Principle 2: Test Setup Information
Any kind of test setup must be done by the @BeforeSuite, @BeforeClass TestNG annotations. Similar manner test clean up should be done by the @AftersSuite,
@AfterClass TestNG annotations if you are using Test NG Based automation framework in your project.
Design Principle 3: Test Folder and Main Folder
All Test classes should be saved inside a folder called “test” and it MUST be a kind of mirror of main folder, meaning it will follow the same structure of the main project folder, but it will only contain tests.
As shown, com.nga will be the group-id for both test and main folder. And all test class methods part of src/test/java package.
Design Principle 4: Maintain Object identification repository
Most common issues faced during automation are object identification changes. Framework should be able to patch such changes easily.
Good design approach creates Object identifiers in page class and also map the object identifiers with page interaction methods in the same Page Class.
Design Principle 5: Status monitoring using debug logs and Exception Handling
A framework should allow monitoring of the test execution status in real time and should be capable of sending alerts in case of failure using exception handling. This design approach ensures quick turnaround time in event of a test scripts failure.
Example Logging Snapshot
Design Principle 6: Reporting
The framework should support html/Excel/Pdf report formats with details about test pass/fail for each test case/suite/test run.
Example Report Snapshot
Design Principle 7: Test Scripts and Test Data
Test scripts and test data should always be separate from each other. Test data input can be in various forms like Excel, Ini, database inputs, hash maps etc.
Example Test Scripts and Test Data Snapshot
Design Principle 8: Creation of Utility Methods
Utility method contain all reusable components. It includes both generic functions, and application specific functions.
Tests should be exposed only to the implemented utility methods and tests should be performed by invoking these utility methods only.
Example Utility Class Methods Snapshot
Design Principle 9: Right code placement
Automation projects tend to grow fast. Along with new tests, new shared code like page objects and data models keep adding during the test development.
Maintaining a good, organized structure is necessary for project scalability and teamwork.
Test cases should be organized by feature area. Common code should be abstracted from test cases and put into shared libraries.
Example Multiple Test Classes Snapshot
Design Principle 10: Avoid Code Duplication
Many testing operations are inherently repetitive.
QA Engineers sometimes just copy-paste code blocks, rather than seek existing methods or add new helper methods, to save development time.
Such Coding practice must be strictly avoided as it not only makes code base in huge size but also result maintenance effort extremely high.
Design Principle11: Multi-Platform Support
Today's business applications run on multiple platforms same time: Multiple Web Browsers, Android Device, IOS Device and some cases Windows Version of application also available
Automation framework must have capability to add on new platform if required by application in future
Browser Factory design pattern provide multi-platform support once implemented in the framework.
To implement all mentioned Test Automation Framework design principles, you can subscribe NGA in house developed Learn Enterprise Level Test Automation program.
Also, Full mentorship support will be made available to understand development concepts as covered in the program with help of prerecorded videos.
For more details about program, Visit below URL:
Founder, Next Generation Automation