Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium Web Test Automation Framework Best Practices [closed]

I would like to know your comments on best practices developing web test automation framework

  1. I basically read couple of blogs and finally got convinced with David Burns approach listed in book - "Selenium 1.0 Testing Tools: Beginner’s Guide" in chapter 7.

  2. Keeping all methods, verifiers of a particular page in a separate class file makes it refined, maintainable.

  3. I would like to know advantages in designing automation framework using design patterns. I am not fully convinced which is best approach. Please add your suggestions. Might be each approach we can list down pros-cons of it

  4. Would it be good if we store all the steps in a database table, fetch and execute the steps ? In this case if any of the test is failed, This would have been updated in the tables and we can selectively run only the failed tests.

  5. Also, Reporting can be done by selectively querying the tables and data can be cleaned-up from those tables through a job. Keeping results/parsing results from test output files is also fine.

  6. If this question is already answered in related posts please post links. I checked few posts before posting this question.

  7. In a website, User Interaction with the website is event driven, The way user can interact with the site can be multiple combinations A->B->C or A->C->B. Doing all possible combination provides maximum coverage. Model based Test Automation covering all possible states

  8. Automation suite that simulates functional regression for all possible state would simulate all user scenarios

  9. Please share your best practices/suggestions for above questions. For all above implementation Dataproviders, passing data in XML we can leverage with respect to test data management.

  10. What design approach we need to consider for developing Model based test automation suite.

  11. Has anyone tried using framework http://www.w3qa.eu/framework.html. Any comments/feedback on the same please provide

like image 275
Siva Avatar asked Mar 19 '11 00:03

Siva


People also ask

Is Selenium still the best automation tool?

When it comes to web automation testing tools, Selenium ranks #1. It is an outstanding open-source automation testing tool that can be executed in multiple browsers and operating systems, supporting a considerable amount of programming languages.

In what scenarios should test automation be avoided?

Another scenario that you shouldn't automate through UI is two-factor authentication (or 2FA). This is where a one-time password is generated using "authenticator" mobile apps such as Google Authenticator or Microsoft Authenticator, and sent by SMS or email.


1 Answers

David Burns is a smart guy. His book is a good starting point for anyone who wants to learn the basics of Selenium and test automation. Of course, take his (and mine, and everyone else's) advice with a grain of salt. There are lots of experts and lots of opposing opinions. You'll have to figure out what works best for you.

Yes. It is definitely a good idea to "keep all methods, verifiers of a particular page in a separate class." You could rephrase that as "separating action and intent" or "programming in the domain language". Either way, you want to avoid writing tests in low-level Selenese. One way of doing this is by using the Page Object test design pattern. Many of the contributors to Selenium and other selenium experts advocate using page objects. It is a good way to make test code more robust, readable and reusable.

Knowing other design patterns is useful too and using them in your test framework is probably a good idea. Unfortunately there is no single 'best' approach. You'll probably have to use multiple patterns and a blend of approaches to achieve good test code. I would recommend starting small, writing a few tests, noticing code smells and re-factoring. Your test framework will grow. You don't have to design it all up front. Be agile. Use an iterative, incremental approach. (Don't use the Selenium IDE)

youtube - Simon Stewart Talks about automated test patterns and Selenium

Rather than putting your test steps in a database table, it's probably better to use a testing tool like Junit or TestNG to organize your tests. TestNG has build in functionality for selectively re-runnning failed tests. It also has really good reporting capabilities. Don't reinvent the wheel here. Learn a testing framework like TestNG or Junit.

youtube TestNG

oh man... I can't post more than two links right now... Oh well... I recommend looking for GTAC videos on youtube, saucelabs videos on viddler, Simon Stewarts blog, the TestNG documentation, examples of page objects and a paper by Brett Pettichord called Seven Steps for Automation Success.

Good luck!

like image 123
Sam Backus Avatar answered Sep 28 '22 02:09

Sam Backus