Code & QA


Since I got to know that new framework for testing a website GUI will be developed soon by our team I made a decision that I have to chair the work or at least to have the ability to affect on the process. The reasons for this decision are not important: I just knew I have to do this. I was a part of the QA team and I had my own vision to the efficiency of the teamwork and to approaches on improving it. I decided to submit my ideas on the creation of an easy to use, not overcomplicated, a maintainable framework which should allow raising automated testing process to the upper level.

I started inquiring what criteria the framework must match. Suddenly I found out that no one knows exactly what they want, neither customer nor management nor superiors nor testers. Everyone wanted just to automate the testing. They were familiar with such words like Continuous Integration, BDT, KDT, etc. They merely wanted everything to be nice and smooth, working fine, being in a state-of-the-art and cool. Moreover, the customers had no idea why they need to automate the testing process, but they believed they can’t do without it.

Eventually, I have designed the requirements which were approved by management and the customer in the end. In few words, the framework must be sufficiently flexible to be used with all the fancy acronyms the customer has heard, so that it could be efficient (not automation for the sake of automation), so that various features could be added/removed with a comparative ease, and so that the framework could be maintained in the working state in the future with the man-hours and profits in mind.

In addition, I elicited from my superiors specific goals, and more or less detailed tasks. This helped me in further in the framework development and in the communication with the customer. Without an understanding of your objectives clearly, anything you do is pointless: in all probability, you will never finish what you’ve started. I’d been working hard to extract that information from the management, and we finally came up with these requirements:

• the framework must cover the regression tests written by the manual testing team

• the tests must be as stable as possible in the majority of browsers (at least IE, FF, Chrome) and on the majority of environments (including slow virtual machines and glitchy remote computers)

• the tests must be easy to write and maintain up-to-date. The tests must be intuitive and simple so that they could be written by people without deep knowledge in programming and the framework specifics

• the tests must exactly reproduce the actions of a real user

• the result of the tests execution must be an accurate and clear log

• free tools must be used whenever possible

• the framework must be scalable and easily maintained by one-two engineers, as we don’t know what lies in store for us, what else the customer may want from us as time goes by, how the application under testing will be changed, what the market requirements will be, etc. So, flexibility and scalability are the crucial prerequisites

• the framework must be developed with a C# programming language (it’s the customer’s requirement), testing is provided with Selenium Webdriver tool and the tests must be executed with NUnit

Finally, having considered all those points, I came to a conclusion that all bicycles have already been invented and I am not such a great and outstanding expert to invent another one. I just decided to use the best solutions chaotically scattered over the Internet, books and my colleagues’ heads.

The first thing I decided to use was the popular template Page Object. You can easily find a huge number of its descriptions on the internet, so there is no need for me to repeat them once again.

Second, I decided to create an entirely operable, fully-fledged framework, ready for commercial use, developed with free tools alone. Let me emphasize it: not with shareware or trial software but entirely free tools.

Also, I decided to create my own test result report, as I can look alter my report in any way I want on the customer’s demand. If someone thinks that reports/logs are secondary, they are seriously mistaken. The report for the customer is of the utmost importance in the framework and its operation, and a clear, simple in use and a visually pleasant report is the guarantee of your success and your salary.

As a result, I made a solution that comprised three projects, each representing a separate module:

1. the first project contains classes and methods for logging all the events that take place in the process of running the tests. It includes the class that remembers the sequence of all the actions of the IWebDriver object and other components and saves the event-related screenshots. On the completion of tests execution, this class generates a report based on the saved data. The log can be represented in any format (from a text file to DB records). I prefer HTML, but there is nothing to prevent me from changing the report saving method to any other

2. the second project is the principal framework project, containing the following:

• classes of elements intended to be used in the testing process

• extension methods for interaction with Selenium Webdriver tool

• global and configuration variables, methods for their initialization

• description of the pages and components of the application under testing. In a word, this project includes the complete description of the entire application to be tested in addition to a set of various supplementary methods

3. finally, the core project: tests proper

Tests must look something like this:

[gist id=05c490d0e360ab98c082d96d82c3bc5b]

I hope after reading the code of the test even the unenlightened person can understand in general what this test does. All tests written in this format are easy for reading and understanding and do not need any documentation as well.


Table Of Content

General Approach

Leave a Reply