Additional Info
What is Selenium ?
Selenium could be a free (open-source) automatic testing framework wont to validate net applications across totally different browsers and platforms. You'll be able to use multiple programming languages like Java, C#, Python, etc to make Selenium take a look at Scripts. Testing is done victimization the Selenium testing tool is sometimes named as Selenium Testing. It provides one interface that allows you to write take a look at scripts in programming languages like Ruby, Java, NodeJS, PHP, Perl, Python, and C#, among others. A browser driver then executes these scripts on a browser instance on your device (more on this at a very moment).
As aforesaid at the start of this journal, Selenium is an associate degree automation testing tool for net applications. It's a free supply automation testing tool that wants to automatize the tests on net browsers. You may be inquisitive about why solely net applications and why not mobile and desktop computer code applications. There are unit alternative tools like Rational useful Tester (RFT), Unified useful Testing (UFT) (former QTP), Watir, Tricentis, and so on for testing mobile and desktop computer code applications.
The first Selenium testing tool was developed by Jason Huggins within the year 2004 UN agency was associate degree engineer at that point at ThoughtWorks. As a region of his work on testing net applications, Jason has completed that manual take a look has become additional inefficient thanks to repetitions of similar test cases. This semiconductor diode led to the creation of a JavaScript program referred to as “JavaScriptTestRunner” to manage browser actions mechanically. Perceiving the potential in his plan, Jason created this JavaScript program ASCII text file and renamed it Selenium Core. Selenium code isn't simply one tool, however a collection of code, each bit line of work to completely different chemical element QA testing desires of a company. Tools are :
- Selenium Integrated Development atmosphere (IDE)
- Selenium Remote Control (RC)
- Selenium WebDriver
- Selenium Grid
Selenium Integrated Development atmosphere (IDE) :
Selenium Integrated Development atmosphere (IDE) is the sole simplest and easy-to-learn part or tool within the chemical element automation testing suite. IDE may be a Firefox plug-in which might be put in simply to record and execute frequent check cases quickly. The user interactions with the net browser area unit recorded and check cases area unit created supported these recordings. You'll be able to playback these check cases repeatedly. Though chemical element IDE is straightforward, it can not be used as a paradigm for writing advanced check cases.
Selenium IDE was an initio created by Shinya Kasatani of Japan as a Firefox plug-in that records and playbacks the user-browser interactions. Thus ab initio chemical element IDE was additionally referred to as chemical element Recorder. The opposite plan behind the event of chemical element IDE was to hurry up the creation of check cases. Later in 2006, he gave this chemical element IDE to the chemical element Project.
Selenium Remote Control (RC) :
Selenium Remote Control has been developed to beat the difficulty of identical Origin Policy (SOP). Below this policy, a JavaScript code cannot access the weather of alternative domains that square measure different from its parent domain. For instance, if a JavaScript program uses a code written for our website computer network then SOP permits it to access the pages web site like all-courses or blog, prohibiting access to alternative domains like google.com.
Before chemical element RC came into existence, testers were accustomed to domestically install the copies of chemical element Core and net server with net applications to be tested so that they each would belong to the one domain. Observing this, Paul Hammant, another engineer at ThoughtWorks, created a chemical element RC that clothed to be the permanent resolution for the matter of the SOP.
How will chemical element RC solve the SOP issue?
Selenium RC tricked the browser to believe that each chemical element Core and therefore the webserver with the online application to be tested belong to an identical parent domain. This has been achieved by involving a proxy HTTP server creating RC a dual-component tool – chemical element RC Server and chemical element RC consumer.
Selenium RC was the primary flagship tool of the chemical element project that permits users of most well-liked languages to write down the test cases. Chemical element RC a pair of 2.25.0 supports the subsequent list of languages.
- C
- Java
- Perl
- PHP
- Python and
- Ruby
- Java
- Perl
- PHP
- Python and
- Ruby
So, it's additionally referred to as a chemical element. But, the foremost downside of RC is, it consumes longer for each server communication taking hours to complete even one take a look at. Unfortunately, thanks to the depreciation, the chemical element RC has been renamed as a chemical element military installation and shifted to a gift package. It means, we can still work with chemical element RC, however, no support is often available for it. You'll be curious what would be the replacement for RC.
Selenium WebDriver :
Also referred to as Selenium 2.0, WebDriver executes take a look at scripts through browser-specific drivers. It consists of:
1. API :
Application Programming Interface. Ports take a look at scripts you write in Ruby, Java, Python, or C# to Selenese (Selenium’s scripting language), through bindings.
2. Library :
Houses the API and language-specific bindings. Though lots of third-party bindings exist to support different programming languages, the core client-side bindings supported by the most project area unit Selenium Java (as Selenium jar files), Selenium Ruby, Selenium dotnet (or Selenium C#, out there as .dll files), Selenium Python, and Selenium JavaScript (Node).
3. Driver :
A viable module that reveals a browser instance and runs the take a look at a script.
Framework :
Support libraries for integration with natural or artificial language take a look at frameworks, like Selenium with Cucumber or Selenium with TestNG.
Selenium Grid :
Selenium Grid is one of the element checking tools employed in combination with element RC to execute test cases remotely. It was created by St. Patrick Lightbody to take care of the reduction of execution times of check cases. Element Grid was ab initio named Hosted QA and was the vicinity of element one.
Selenium Grid uses the Hub-Node style to support the parallel execution of multiple check cases on multiple machines that are remotely situated. In Hub-Node style, one machine is treated as a Hub that controls the check cases running on totally different browsers within different operative systems. The opposite machines are treated as Nodes on that check cases may be written in user most well-liked programming languages.
Here comes the tip of the fundamental introduction of the element QA tool and its parts. Currently, you'll be introduced to alternative testing tools except for the element tool and why an element is the best among them by scrutinizing the highest 5 testing tools.
History of Selenium :
A timeline of major events within the evolution of Selenium from an in-house side-project to an ASCII text file industry-standard in browser automation:
2004: Creating history in 2 elements (from Selenium A to B) :
- Jason Stargazer of ThoughtWorks must take a look at his internet app’s front-end behavior across totally different browsers.
- He develops a tool that works by injecting JavaScript beneath the webpage, permitting the tester to write down code that might ‘automate’ front-end user interactions. This became the JavaScript TestRunner.
- Though the JS-injection approach couldn’t naturally replicate user interactions (via keystrokes/mouse movements), it had been a workaround for the ‘same-host origin policy’, that prohibits external JavaScript code from accessing components from a site it didn’t originally reside in. All the same, the tool is completely received by in-house developers and ThoughtWorks’ purchasers alike.
- The tool is open-sourced because of standard demand.
- To eliminate the requirement for JS-injections, Huggins, together with colleague Paul Hammant, discuss the chance of a ‘server’ part. This server would act as a communications protocol proxy and trick the browser instance into a basic cognitive process that takes a look at the script and therefore the internet app beneath takes a look at square measure from a similar supply.
- They develop the server part in Java and therefore the original client-side driver (TestRunner) gets ported to Ruby.
- This is the first Selenium. Called Driven Selenium or Selenium B within the evolution timeline.
2005: Selenium RC (Remote Control) :
- Elsewhere (at Bea, specifically), Dan Fabulich and Lord Nelson Sproul begin performing on the driving force technologist. They eventually mildew it into a standalone server that bundled MortBay’s mole as a communications protocol proxy.
- This becomes ‘Selenium RC (Remote Control)’ or Selenium 1.0. Before we tend to move 2.0, there's another vital development within the kind of…
2006: The Selenium IDE :
- Shinya Kasatani wraps the Selenium driver code in an IDE module within the Firefox browser.
- When it works, he finds that he will run a useful ‘live test’ on a website—interacting with the browser (as a user would); recording/replaying the interactions, and debugging as needed.
- Kasatani donates this tool to the Selenium project wherever it becomes called the Selenium IDE.
2007: The Selenium WebDriver (Selenium two.0) :
- Back at ThoughtWorks, Simon Stewart diligently codes up separate ‘driver’ purchasers for each standard browser, thus they’d all support automation with native browser capabilities.
- It pays off. The project became famed because of the WebDriver.
2008: Multiply by ‘n’: Selenium Grid :
- At ThoughtWorks, Philippe Hanrigou creates a server that may permit testers to access and run tests on browser instances on any variety of remote devices.
- This becomes called the Grid. Cut to.
2016: Selenium RC gets deprecated and WebDriver becomes customary implementation—aka Selenium 3.0.
2019: WebDriver becomes a W3C customary protocol.
Why do I need Selenium Automation Testing?
Imagine that a manual tester has this scenario: Checking whether or not the net app’s signup page (www.example.com/signup) validates input strings and registers a user with success within the latest versions of Chrome and Firefox, on Windows seven. Assume that the signup page has these input fields—username, email address, and watchword. The tester can get a Windows seven desktop and follow these steps, consecutively, on the newest versions of Chrome and Firefox :
- Enter the computer address within the address bar (www.example.com/signup)
- Enter an associate invalid string in every input field (email, username, and password)
- Check whether or not the input strings were valid against corresponding regexes and any pre-existing values within the information
- Enter ‘valid’ strings in every input field; click sign in
- Check whether “Welcome, ‘{‘username’}’“ page showed up
- Check whether or not the system information created a replacement userID for ‘{‘username’}’
- Mark the check ‘passed’ if it did, ‘failed’ if the signup features stone-broke anyplace throughout the check.
That’s a really basic system check. Within the planet, testers are a lot doubtless to be checking all user workflows on www.example.com for breakage, on as several OS-browser combinations as needed to satisfy the benchmarked compatibility standards. Depending on the quantity of manual checkers (and conscientiousness of test cases), it should take any place between hours to weeks to take care that the net app is absolutely useful.
Modern developers and product groups don’t have that sort of your time to permit for testing, however, they can’t put aside complete testing in an exceedingly hurry to unharness either. This is often why they super-charge their testing with automation, battery-powered by antioxidants.
What Types of Testing can be Automated with Selenium?
Types of testing that are ordinarily automatic with Selenium are :
1. Compatibility Testing :
Done by QA professionals/Testers to confirm that the net app meets performance benchmarks on totally different browser-OS mixtures. for instance, testing on different devices (mobile and desktop) to confirm that the front-end fits to scale (responsive); testing on different browsers to visualize if video ads render on the pages as they ought to.
2. Performance Testing :
Series of tests done by QA professionals/Testers to confirm that the project meets performance benchmarks set by the stakeholders. Tester writes a script that checks whether or not all components on the homepage load inside two seconds on totally different browsers/browser versions.
3. Integration Testing :
Done by developers to verify that units/modules coded individually (that work on their own), additionally work once placed along. Parallel check Calculator, for example, has separate layers. UI takes input and business logic calculates the output—then sends it back to UI to show. The tester might verify whether or not they can relay data/output once integrated.
4. System Testing :
aka recording machine testing. Done by Testers/QA professionals with no context of the code or any antecedently dead tests. Usually targeted on one user advancement. The check-out method on a product website, for example, contains collateral user credentials, taking merchandise from the cart, checking their convenience, and collateral payment details—before redirecting to the bank website. The tester might write a script to verify that the complete system is useful.
5. End-to-end Testing :
Also done by Testers/QA professionals, usually from the user’s purpose of reading. The aim is to verify that each one touchpoint on the net app is useful. From the previous example, the checker might write a series of test cases to examine that sign-up, product search, checkout, review, bookmark, and every one alternative option perform as intended (and fail once invalid values are entered in input fields).
6. Regression Testing :
A series of tests done to confirm that fresh engineered options work with the present system. For example, say the merchandise website launches a brand new feature (promotional codes) that mechanically applies to eligible things before checkout. The tester might write cases to verify that it doesn’t break the remainder of the checkout feature. Well-written check suites also can modify Smoke and sanity testing with Selenium
Advantages of Selenium
- Selenium is an associate ASCII text file automation testing tool and it's free from price to use.
- Selenium provides high checker flexibility to put in writing advanced and sophisticated test cases.
- Supports check scripts written in any user-preferred languages like C#, Java, Perl, PHP, Python, and Ruby
- Supports action execution on multiple operating systems like Windows, Linux, Android, Mac, and iOS.
- Supports testing on completely different net browsers like Chrome, Firefox, net adventurer (IE), Opera, and Safari.
- Test cases are dead whereas the browser window is decreased.
- Selenium supports parallel check execution.
- Selenium is integrated with TestNG and JUnit to come up with check reports and manage check cases.
- Selenium is integrated with Jenkins, Docker, and experts to achieve continuous testing.