Improve selenium WebDriver tests performance

2 min


648
1 comment, 648 points
Improve selenium webdriver tests performance
Improve selenium webdriver tests performance

Improve selenium WebDriver tests performance

So far I was involved in couple of projects optimisation of the selenium tests and I will try to share with you how you can improve selenium webdriver tests performance.

Tip #1: Data independent tests

Most dependencies are data related

  • Dependent tests = no parallel execution
  • Data should be test specific with no reuse
  • Use small focused datasets

independent test data

Test data generation techniques
  • Use Registry with counter to generate uniquedata
  • Fill database with large amount of data and use reservation
  • Use database sharding on application side
  •  Shard data by unique key (user name, email,etc.) and insert data sets with DbUnit

Tip #2: Atomic focused tests

  • Small test has clear goal and easy to understand
  •  Easy to divide in suites
  •  Flexible running in multiple stages
  •  Report failures are easier to understand
  • Run quickly so higher level of parallelisation

 

Tip #3: Test only functionality

  • Don’t pay attention on design and content
  • Simplify everything except functionality under test
  • Run complex tests in reliable browsers

Tip #4: Generate application state

  • Insert data directly in data storage
  • Don’t use complex UI to generate state
  • Use small isolated datasets and simple tools

Tip #5: Test widgets in isolation

  • Create unit tests for JavaScript code
  • Load widget on empty page and test it well
  • Try to use reliable widgets library

Tip #6: Isolate all third-parties

  • Use quick fake email server
  • Mock all external services
  • Switch all third-party components in quick predictable mode
  • Run everything locally
Use HTTP proxy for texts
  •  Blacklist external resources (Facebook, Twitter,Ads, etc.)
  • Cache images and other nonfunctional resources
  • Collect HTTP traffic for analysis (404, redirects,loading time, etc.)
  • Speedup page loading

Tip #7: Use smart waiting

  • Every delay is multiplied by number of tests
  • Don’t use speed and pauses at all
  • Use implicit waits carefully
  • Always think about the worst scenario and set good timeouts

Tip #8: Monitor your tests

 

Hope this will help you to improve you selenium WebDriver tests performance.

Don’t forget to add any thoughts you might have in the comment section bellow.

Happy testing!


Like it? Share with your friends!

648
1 comment, 648 points

What's Your Reaction?

cute cute
0
cute
scary scary
1
scary
wtf wtf
0
wtf
geek geek
0
geek
WIN WIN
0
WIN
Love Love
0
Love
OMG OMG
0
OMG
Angry Angry
1
Angry
Lol Lol
0
Lol
Test engineer

One Comment

Your email address will not be published. Required fields are marked *

Choose A Format
Trivia quiz
Story