Designing Test Automation Framework with Selenium
Do we need to go for Test Automation? If yes, then which is the tool? If we straight away start automating test cases what are all the technical challenges we might face? Do we need a framework for Automation? How we go about designing a framework?
These are all the questions popup when we want to start Test Automation. Okay, let us start exploring answers for the above questions.
If there are hundreds of test scenarios which needs to be executed on each build then it will be a tedious task and error prone. Because a Test Engineer might make mistakes while entering the test data and output might be wrong. We can avoid such situations by automating the test cases.
Before selecting a tool for Test Automation, we need to analyze the technologies used for different UI components. For example, Java Swing components, Telerik controls, ExtJS tables, Ajax, Silver light, Flex / Flash controls, etc. If we want to use Selenium as Test Automation tool then the first and foremost thing needs to be checked is whether the application is a Web Application. If so, then check whether most of the UI controls are identified by the Selenium. If more than 70% of the test cases can be automated then definitely we can go ahead and automate the test cases.
In order to handle large number of test cases we need to have a clear cut strategy for designing the framework. Some of the framework functionalists can be mentioned as follows:
If there is any unhandled exception, then the execution should not stop. Particular test scenario should be stopped and continue with the next scenario.
Screen shots must be taken for each error so that analyzing the failures should be easy.
Proper exception handling should be done in the framework.
Proper naming convention should be used
Avoid hard coding test data
Test Data should be parametrized using external means such as XML s, Database, Spreadsheet, etc.
Logs should be created that makes life easier while analyzing the Test Execution
Proper folder structure should be created.