At PicScout, we believe that every step in our development workflow that can be automated should be. Testing is one of those steps where automation is needed. Automated testing allows us to implement new features quickly, as we can always prove that the product still works as we expect.
In order to automate our testing process, we chose to work with Selenium among other tools we are using. Selenium is an open source set of tools for automating browser-based applications across many platforms. It is mainly used for web applications testing purposes, but is certainly not limited to just that.
Our approach is that most of the automation should run locally to keep the continuous integration environment clean as much as possible. This is very important step for stepping up to continuous deployment. Therefore, we build a mechanism that enables to run the automation including selenium locally. By using this mechanism, the SW engineers can ensure quality up to a certain level.
Each developer must first run the automation including Selenium on the local machine before hisher changes are pushed to the source control repository. To achieve this, each developer works on his own environment and doesn’t interrupt other developers. That way the selenium testing environment stays “clean”. In order to ease the developers’ life a set of tools was developed which is responsible for updating the DB and running the tests.
The tests use dedicated DB which contains the relevant data; hence before running them the DB needs to be restored from a backup stored in the source control repository (aka GIT). In case a new selenium test is written which requires some data changes, the tool allows publishing the local DB to the repository.
Furthermore, selenium tests are written over NUnit Framework. NUnit Framework runs the tests in sequence, meaning one after the other. This can be time consuming since some tests can run in parallel as long as they are not affected by each other. Running tests in sequence takes about an hour, while in parallel it takes only 10 minutes!
Therefore, we developed a tool that supports serial and parallel modes for running tests. In order to run tests in parallel, we had to isolate each test from another. To achieve this, we had to make sure that the tests don’t use shared DB resource or information (including but not limited stored procedure, tables etc.). By doing that, we know for certain that at any given time, no test will disturb any other test while still pushing the performance to the limit and finishing all of the tests in minimal time, as opposed to running tests in sequence manner.
That’s about it on how we use selenium at PicScout.