简体   繁体   中英

Tests are running too slow for local web app. using C# Selenium WebDriver

I'm using C# selenium WebDriver(latest version), and I have written some tests for a web application

The tests have been run perfectly when the web app. is hosted on a server, but when I were trying to run the same tests for the same web app. and is hosted on my machine locally, they are very slow, any help would be appreciated

Thanks

I had the same issue you're experiencing. I have two suggestions. As @BugFinder mentioned, odds are that you need a more powerful local machine. That will help a ton, however there could be two other issues that you're experiencing that cause massive slowdown.

Whenever a test runs, if it fails and you do not have a [TearDown] (or if you ONLY have a [OneTimeTeardown]) the system does not dispose of the driver or the console host that Selenium uses to run tests, so there is a chance that you have massive memory leaks that could slow down testing heavily. I created a simple batch script that ends all processes related to the tests that has these two simple commands (If you aren't using IEDriverServer replace that with ChromeDriver or whatever you use):

taskkill.exe /F /IM IEDriverServer.exe /T
taskkill.exe /F /IM conhost.exe /T

If you are running locally you can run the batch file yourself or you can implement this into your remotely run tests through AutoIT or a similar program. If this issue is one that persists for you, you can have 5mb of memory for EACH IEDriverServer (or whatever driver you use) and a couple mb of memory for each conhost process running. If you run 100s of tests, you can see how that can add up quickly.

I hope that this answer either directly helps or gets your mind thinking about the solution to your problem.

As you guys said, the whole thing is because the local machine I have noticed that my anti-virus was running a full scan recently, so that the tests were too slow. Things are normal now on the local machine :)

Thanks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM