Monday , 20 November 2017

Free Tutorial: Selenium Framework Architecture

With the improvement in the area of the automation testing field, it is now easier for the testers to perform the sets of regression and smoke tests prior to any release of new version. Automation testing tool saves both the human resource and time simultaneously increasing the accuracy of the test. Selenium is the best tool if you are performing web based testing.

Benefits of the selenium automation tools are

  • Minimizes the execution time of the tests considerably
  • Reduces the human resources
  • Quick analysis of deviation between actual results and expected results
  • Helps you to change the test’s preconditions and analyze the test cases on the multiple sets of data with great accuracy

In any automation tool, you have to focus on the automation workflow in a project. For that, you have to consider following points in order

  • Identify all the task that application has to perform.
  • Create a set of necessary input
  • Evaluate the expected results so that deviation can be calculated from the actual results
  • Run a test
  • Compare the result with the actual results and report them in your reports whether the test has been passed or not.

While implementing the architecture, you need the following environmental specifications

  • Selenium Webdriver – It Supports all major browsers including Firefox, Chrome and IE to run tests. You can write your test scripts in C#, Java, Python, Ruby, .Net, Perl, PHP, etc.
  • Eclipse IDE – is an Integrated development environment for Java.
  • Java
  • TestNG – is a framework inspired from JUnit and NUnit which implements IReporter as an interface to generate the customized testing reports.
  • AutoIT Tool – For automating Windows GUI and general scripting.
  • JExcel or Apache POI to perform operations on excel sheets like read, write and update.

Below is the graphical representation of the Automation Framework Architecture

automation_architecture

 

The different type file formats which can be used in the Selenium Framework are

  • Excel Files – In the process of testing, excel files are used to enter multiple sets of data as an input
  • XML Files – are used to execute the test scripts. The XML scripts are executed on the basis of package or classes or tests mentioned in the files.
  • .html – are created to store the results of the test case performed.
  • . Properties files – stores the project setting, configuration data, database configuration, XPath or CSS selectors, ID of the name, elements etc. In . properties files, each parameter is stored as a pair of strings i.e Key and value.

For e.g. String key = (String) KeyValues.nextElement();

String value = prop.getProperty(key);

The steps to create the properties files are very easy. Just go to File menu -> New -> Click on File. Now give a file name and save it as a .properties files.

While creating an architecture, you should keep in mind about the arrangement of classed and subfolders in a tree. If the tree structure is not clear, then it can lead to a serious confusion in the later stages of the testing.

The Folder structure needs to be in the order of

Project Name –Name of your project

  • Classes (Test Automation Scripts)
  • Config files
  • Execution Reports
  • Test data
  • UI Map
  • TestNG

Test Automation Scripts: A test is a single or a series of actions which determines whether a specific feature meets the functional requirements as described in the software requirement specification. It is basically a collection of class files, packages or test files which run as described in the testng.xml.

Config Files – Configuration properties files usually stores parameters like the path for log files/test data/ results, execution speed,wait period etc.You can change these values in the configuration file whenever required.

Execution Reports: It basically stores the summary of the test cases performed. You can get the execution time along with Pass/Fail status which will help the project manager to analyze and make decisions.You can also capture the screenshots of the failed cases and store it in an excel file with their status.

Test Data:  The test data which will be an input in the test case can be anything for e.g excel files, database files(Acess, SQL,Oracle), text files,XML files etc.When we run the test, scripts reads data from these external data sources and execute the test cases.So we suggest you to devote time in creating the valuable datasets so that your tests can run effectively.

UIMap: UIMap is based on the Key-Value concept in which  we create .properties files defining, storing and serving UI elements of your pages.for e.g. middleName=id=miname .

TestNG: TestNG will act as a driver which have a capability of running multiple test cases from the multiple classes wit the help of xml configuration file.The main advantage of the testNG is that you can manage your tests as per groups, classes, package,methods etc which will help different teams to share the TestNG files and perform parallel testing on different modules.

Note: If you are creating your framework first time then we suggest you to follow the step in order and create the framework in such a way so that they will be helpful for both tester and developers.

Check Also

An Overview About The Web Testing Tool – Selenium

With the infusion of new technologies in the software industry, software testing has become a …

2 comments

  1. Good to see nice article about the selenium architecture. It will really helpful to the candidates who begins with their career towards automation.

  2. Hi,

    Thank you so much for posting this. I really appreciate your work. Keep it up. Great work!

Leave a Reply

Your email address will not be published. Required fields are marked *