Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

1 like 0 dislike
158 views
in Selenium by
retagged by
I use C# + NUnit+Webdriver and use [Parallelizable],

I don't use thread.sleep and implicitywait

What can I also do to make my tests running faster?

 

Now I have more than 300 scripts and 1 round in 1 browser takes ~4hours, what is totally too long

1 Answer

1 like 0 dislike
by The go-to Tester (181 points)

There are multiple parameters we have to consider.  Slowdown may not be only because of C#, slow down is very generic problem with WebDriver

Speed of the machine.

1. If you are executing it from the local machine where your own test scripts are, consider moviing it to dedicated computer.

Selenium Grid

2. Try using selenium Grid for test execution. This will distribute load and your execution can be much faster.

Element identification

3. Try to use relative xpath instead of identifying element under another element. E.g.

WebElement eleA = driver.findElement(By.id("eleA"));

WebElement eleB = eleA.findElement(By.id("eleA")); 

Screenshot

4. Try avoiding screenshot. As it takes your disk through lots of read and write process. If possible take screenshot of only failed test cases

Reporting

5. Make sure that you have proper reporting in place. You may be adding lots of stuff into memory and this may lead to slow down as well. - This is really the least thing to consider as .net is good with memory management. Yet, we need to consider this.

Dedicated machine

6. If possible, try to use dedicated machine with browser loaded and no plugins for the browsers. This will help you speedup a lot.

Temp file

7. Try to clean up temp files more frequently. Too much of files inside %temp% folder can slowdown your execution as well.

 

Above are few generic solutions I have. If you have already implemented above solutions, we need to discuss about your project implementations.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...