Selenium and Yii

Background

This project’s objective was to develop a set of automated functional tests for a web application developed using the PHP Yii framework.

The application mostly consists of “CRUD” type screens for data creation, modification and visualization.

The tests were developed together with the code. Each delivery of a module or screen was accompanied by a set of functional tests, especially for validating the business rules associated with the creation or modification of the data.

The tests were thus used to validate the developments at a unitary level and for regression testing.

Technical environment

The development environment uses the Ubuntu OS, NetBeans IDE and MySQL Workbench modeling tool.

The integration server is a Ubuntu virtualized server, acting as an SVN server and a continuous integration server through phpUnderControl (later migrated to Jenkins).

For the execution of functional tests, dedicated virtual machines were installed, with different OS (Ubuntu, Windows XP, Windows 7) and different browsers (IE6, IE8, Firefox, Safari, Chrome, Opera).

It uses the version 1.0 of Selenium.

Setup phase

The Yii framework natively integrates the ability to create functional tests with Selenium.

The implementation of test automation is relatively simple and standard.

Moreover, the application is very uniform and it was therefore simple to factor the test procedures in order to expedite the drafting of tests and facilitate maintainability.

However, we had to overcome some technical difficulties, particularly for the implementation of the continuous integration server and the use of PHPUnit to run the functional tests.

Results

In the maintenance phase, functional tests are performed at each change of the code.

The regressions are detected immediately, and the update of functional tests, in the context of this project, are very inexpensive (whether for correction or evolution).

The risk linked to maintenance is extremely low. Whatever the impact of the change, regardless of the person who performs the automated functional testing, there is a guarantee that the quality of the application will be maintained.

However, we must ensure that the tests are well maintained, together with the code. If the test of new features is not automated, or if the tests that fail are simply removed, the system can quickly lose its effectiveness and the cost of maintenance will increase sharply.

One Comment

  1. Stas-Reply
    April 9, 2021 at 10 h 17 min

    I prefer to use Codelobster IDE for Yii development – http://www.codelobster.com/yii.html

Leave A Comment