I have a set of UI tests (around 40 in total) that are written in C#
using Selenium WebDriver + ChromeDriver + NUnit.
Till the last week, it took around 40-50 minutes to execute the set. Then suddenly the execution time was tripled and now takes around 2 hours 30 minutes. There were no changes in tests and test framework itself.
After the issue appeared, I updated Selenium WebDriver library and ChromeDriver to the latest version (Selenium 2.48.2.0). It didn't help me at all.
Our web application that tests are testing is written using BackboneJS. I had a talk with our developers. They claimed that there were no significant changes to the code itself.
The most interesting part is that we already had this situation when tests started running a bit slower, but the time difference was not so huge.
Investigations and conclusions I did:
- there is no dependency on browsers and browserdrivers. The same slowness is when running tests in Firefox or Chrome;
- there is no dependency on machines where tests are running. The same slowness is on different PCs;
- there is no dependency on environments. I checked 2 different ones (different servers and configurations). All the same for our web application;
- I also did all possible tricks suggested on the Internet (disabling proxy in settings, although it was not used. Turning off hardware acceleration in Chrome, although it's always ON when selenium creates a browser instance. Tried different versions of WebDriver, etc.). Nothing really helps;
- I also made sure we are targeting "Any CPU" to avoid issues described here.
I installed dotTrace and profiled one of the tests. Almost all time of test execution is taken by selenium methods such as FindElement or GetText. Digging down the methods I found out that System.Net.HttpWebRequest.GetResponce
takes almost all time.
I run out of ideas "why?". The page is loaded completely and fast. Firstly, I thought that there was some issue with frontend javascript, maybe async code etc., did profiling in Devtools, nothing suspicious.
I guess there might be something failing in communication of Selenium and BackboneJS. Something that is not noticeable in UI, but definitely has influence.
This is very frustrating and critical for us. If anyone has any ideas of what might have influence or had similar issues, please share. I would appreciate any ideas and experience.
Thank you.