Windows 10 is gaining popularity and so does Edge, the new browser that comes with it. With this increasing popularity it becomes important to verify the compatibility of your software with the new platform. Recently I was asked to verify that our Software behaved correctly when using it with Microsoft Edge. While it would have been possible and easy to just do some manual checks, this would not suffice and will not guarantee future changes to be compatible with Edge.
But since we already have automated tests for other browsers, it makes sense to just add Edge as a browser on which these tests have to run. Trying some new technology can be challenging, and often problems arise. Trying to get our Selenium tests running with Edge was no exception.
A test should be designed such that it can be executed as fast as possible, getting the result as soon as possible, preventing interrupting the process of developing. A popular test framework to test web UI’s is Selenium. However, these tests can take much longer than they should be, which is something I experienced lately. To solve this I have investigated the cause of these slow tests, and how they can be improved.
A major reason for slow tests, are failing tests. While this may not be too common, as a failing test should be a warning and a trigger to fix what was broken, it does happen. A failing test often is waiting for something to become visible, present, selected or another state. Due to some changes in UI or bad selectors, we may be looking at the wrong element, or an event was sent wrongly.
The wait often involves a numerous amount of seconds to give the UI some time to refresh and update.
A first step to decrease the build time of a Selenium testsuite is to make sure all tests pass. This should be evident, and is not further discussed here. A second step to decrease the build time of any testsuite is to make sure your tests don’t do obsolete work. This can be any type of actions, such as restoring a backup but never using it.
While these two actions hold for any type of test, there is a third action that only holds for Selenium. The expression used to select an element, since selenium offers various ways to select an element, it is hard to know what the best approach is. Which is why I have compared them.