This post was most recently updated on June 14th, 2019
Automation testing – In STLC, Regression testing plays most important part which verifies old functionalities of a web application is working fine while new changes also get along with them well.
But the regression testing can be a lengthy and time consuming process. So the testing processes which are repetitive and time consuming can be automate which reduces the efforts in such type of testing activities.
- Benefits of Automation testing –
1. Automation testing saves the testing time
2. Automation testing covers larger testing scope.
3. Automation testing completes repetitive work with same accuracy.
4. Automation testing can reduce the risk of human errors.
5. Automation testing can improves the re-usability of test scripts - Selenium an automation testing tool –
Selenium is open source automation testing tool which is used for running the test script and to automate the web applications. Due to open source (free) tool this is widely used automation tool in the market. - Pros & Cons of the selenium automation tool –
Pros –
1. Open source tool
2. Supports multiple programming languages
3. Supports multiple browsers and Operating system.
4. Selenium tool have widely spread community for support.
5. Useful to test complex functionalities
Cons –
1. Can test web based application only; No desktop applications
2. No official support
3. Tester should have basic knowledge of programming language which supports selenium
4. Not able to test mobile application
5. Difficult to test images on the web application
6. UI testing not possible with the automation testing
- To Setup Selenium – follow the below mentioned link which has step by step detailed process to set up selenium on windows 10 – https://mundrisoft.com/tech-bytes/install-selenium-webdriver-windows/?hilite=%27selenium%27
- Important elements in Selenium scripts for tester-
While using selenium if user can find proper web-elements or locate web-elements using there exact Xpaths will help tester to get more expertise in the automation testing. Also user should know how and when to use which wait in the script is the key.
1. Locators – Locators in Selenium can be use to identify the unique address of a web-element. There are 8 explicit locators in the selenium –
ID – This is the most preferred way to identify the web-element due to its uniqueness.
Name – Name attribute can be second most preferable locator to identify the web- element
Class – Class locator help to locate the web-element using the the class attribute in the HTML code.
LinkText – User can locate the web-element which has link with the exact link text used in the anchor tag .
Partial LinkText – Web-element having link to it can be located using the partial text or matching text of the link mentioned in the anchor tag.
Tag Name – User can locate the web-element using the tag name attribute
X-path – Each web element has its own x-path; user can locate web-element using it.
CSS Selector – Web-element can be located using CSS selector.
2. X-Path Locator – Xpath is XML path language. Xpath can be used to locate the specific web-element if no distinct locator is available. There are two type of Xpaths –
Absolute Xpath – Absolute XPath starts with the root node or a forward slash (/).
Relative Xpath – A relative xpath is one where the path starts from the node of your choice – it doesn’t need to start from the root node.
3. Waits – The web-applications are created using different set of Web development techniques using many web technologies . So when web page loads in the browser the web-elements load at different time intervals hence it is necessary in automation to wait till all page elements load properly to locate them and to avoid the exception or error.
There are three type of waits in selenium –
Implicit wait – In implicit wait system will wait till page or all web-elements of the web page to load before code execution.
Explicit wait – It is based on particular condition – explicit wait will execute if particular condition fulfilled on the web page.
Fluent wait – Fluent wait is extension of explicit wait. In this wait system will check the particular condition has been fulfilled or not after every specified time interval and will not wait for the time if required web-element is loaded.