Selenium Basics For Beginners
Selenium Basics For Beginners, What is Selenium?, Features of Selenium Components, Selenium License, Advantages of Selenium, Disadvantages of Selenium, and Selenium Test Environment Setup.
According to Selenium official website (selenium.dev), Selenium automates browsers
Selenium primary purpose is Testing of Web Applications, and It is also supports web based administration tasks.
1. Selenium is used for Functional & Regression Testing of Web Applications
Selenium supports Acceptance Testing (Functional Testing in Acceptance Testing Level, and System Testing (Functional Testing in System Testing Level).
Selenium is also supports some sorts of Performance Testing (Load Testing and Stress Testing), but it is not recommended for Performance Testing, since it is not designed for Performance Testing.
Use Selenium only for Functional Testing, and you can use JMeter like test tool for Performance Testing.
Examples for Software Test Tools:
Functional Test Tools: Selenium, Micro Focus UFT/QTP, IBM RFT, SilkTest, …..
Performance Test Tools – Micro Focus LoadRunner, JMeter, IBM RPT….
Test Management: ALM (formerly Quality Center), Jira etc…
Defect Management: Bugzilla, Mantis etc…
Web Services Testing: SoapUI
Mobile Testing: Appium
2. Selenium is Open source software to automate web applications, and Selenium License is Apache 2.0
Selenium is Open Source software, anybody can download and use this software with free of cost, you can modify the source code & use it, you can distribute the modified source code to others, but selling modified code is not allowed.
The primary objective of Apache 2.0 license is – Selling modified code is not allowed, means no commercial use of Selenium software.
3. Selenium supports various operating systems to conduct testing
4. Selenium supports various programming languages to write Test cases/Test scripts
Selenium previously supported Languages
Selenium current supported Languages
5. Selenium supports various browsers to conduct testing.
Microsoft IE / Edge
6. Re-usability and Integrations
Selenium automation test suites are reusable and can be tested across multiple browsers, and operating systems.
Selenium is not an all inclusive test tool, it needs third party frameworks and addons to broaden the scope of testing.
i. Editor – Eclipse IDE – Editor for writing and executing programs
(Eclipse is an open-source platform of software development and it supports various Operating platforms.
Eclipse was developed for Java applications, plug-ins allow programmers to develop applications with other languages, including C, C++, COBOL, Perl, PHP and Python.)
ii. Programming Platform – Java – To write Test Scripts and enhance Test Scripts
iii. Test Tool – Selenium WebDriver Java language binding – to write Test Steps
iv. Testing Framework – TestNG- prioritizing Test Cases, Grouping Test Cases, Executing Test batches, Parallel Testing and generate Test Reports.
v. Build Automation Tool – Maven – Easily setup Test Environment and easy Maintenance of the Environment
vi. CI Tool – Jenkins – Continuous Integration (integrating Testing process with development process) etc….
7. Selenium supports Batch Testing, Data Driven Testing, Cross Browser Testing, and Database testing
Batch Testing – Executing series of Test cases, by integrating a Testing framework like JUnit or TestNG with Selenium then we can conduct Batch Testing.
Data Driven Testing – Executing Test cases with multiple sets of Test Data. With support of a programming language (Ex: Java), you can read text file or excel file and conduct Data Driven Testing.
Database Testing – Testing the back-end databases using SQL statements. With support of a programming language (Ex: Java), you can connect to Databases using JDBC and conduct Database Testing.
8. Selenium Components / Selenium Tools
i. Selenium IDE:
Selenium IDE is a browser plug-in (Firefox and Chrome) and prototype tool, it is used to write and execute test cases, user/tester can record the test cases or type test cases, user/tester can edit test cases (Add/Update/Delete), user can create test suites, and user can debug test cases, and add comments.
Selenium IDE Test cases can be created using Element locators and Selenese Commands
ii. Selenium RC:
Selenium RC was out dated, and it removed from the latest versions of Selenium.
iii. Selnium WebDriver:
Selenium supports various Operating systems, programming languages, and browsers.
Selenium WebDriver supports Batch Testing, Data Driven Testing, Cross Browser Testing, and Database Testing.
iv. Selenium Grid
Selenium Grid is only for Test execution, and doesn’t support Test case development
Selenium Grid supports parallel testing
(It can execute selenium Webdriver test cases against different browsers, operating systems, using multiple machines (computers)
9. Selenium guidelines and recommendations
i. Page object models – Page Object is a Design Pattern which has become popular in test automation for enhancing test maintenance and reducing code duplication.
ii. Mock external services – Eliminating the dependencies on external services will greatly improve the speed and stability of your tests.
iii. Improved reporting – Selenium is not designed to report on the status of test cases run. Taking advantage of the built-in reporting capabilities of unit test frameworks is a good start.
iv. Avoid sharing state – Do not share test data. Imagine several tests that each query the database for valid orders before picking one to perform an action on.
v. Test independency – Write each test as its own unit. Write the tests in a way that will not be reliant on other tests to complete.
vi. Fresh browser per test – Start each test from a clean known state. Ideally, spin up a new virtual machine for each test.
10. Selenium worst practices
i. Captchas – CAPTCHA, short for Completely Automated Public Turing test to tell Computers and Humans Apart, is explicitly designed to prevent automation, so do not try.
ii. File downloads – Whilst it is possible to start a download by clicking a link with a browser under Selenium’s control, the API does not expose download progress, making it less than ideal for testing downloaded files.
iii. HTTP response codes – Selenium acted as a proxy between the browser and the site being automated. This meant that all browser traffic passed through Selenium could be captured or manipulated.
iv. Gmail, email and Facebook logins – For multiple reasons, logging into sites like Gmail and Facebook using WebDriver is not recommended.
v. Test dependency – A common idea and misconception about automated testing is regarding a specific test order. Your tests should be able to run in any order, and not rely on other tests to complete in order to be successful.
vi Performance testing – Performance testing using Selenium and WebDriver is generally not advised. Not because it is incapable, but because it is not optimised for the job and you are unlikely to get good results.Follow me on social media: