Saturday, April 9, 2016

Automation Testing for Manual Testing professionals


What is automation testing ?


Use of special software (separate from the software being tested) to control the execution of tests and the comparison of actual outcomes with predicted outcomes.




Automated Software Testing is the application of automation technology throughout the software testing life cycle with the goal of delivering capability faster and more afford ably.
A process in which software tools execute pre-scripted tests on a software application before it is released into production.

Using automation tools to write and execute test cases is known as automation testing.
The process of software verification in which the basic function and test steps, such as running, initialization, execution, analysis and delivery of results are performed automatically by tools for automated testing.

So whats automation testing or test automation? as per bolton and bach*

from the definitions we have seen till now, we can summarize following
  • we automate test cases, which are nothing but steps followed by end user, hence automation testing is automating user
  • we automate test cases execution , which are executed by tester manually , hence automation testing is automating tester
but that's not true
 We see at least three big problems here that underestimate testing:
  • The word “automation” is misleading. We can not automate users. We automate some actions they perform, but users do so much more than that.
  • Output checking can be automated, but testers do so much more than that.
  • Automated output checking is interesting, but tools do so much more than that.

Test automation is not human at all. It’s incredibly fast and inexpensive

We define a tool as any human device that aids in fulfilling a human purpose. A test tool could be software; hardware; a map, document, or artifact; or some other heuristic that aids in fulfilling a testing purpose.

Automation testing is we automate error prone repetitive tasks,
automated testing is not really testing. It is checking of facts.


Why Automation Testing ?

Save Time, Save Money

Automated software testing can reduce the time to run repetitive tests from days to hours.
A time savings that translates directly into cost savings.
It means you saves time required for repetitive test execution and you saves money.
  

 

Manual Testing of all work flows, all fields , all negative scenarios is time and cost consuming

 

Increase the effectiveness, efficiency

Software Test Efficiency is number of test cases executed divided by unit of time (generally per hour). 

Test effectiveness = Number of defects found divided by number of test cases executed. 





  • Automation does not require Human intervention. You can run automated test unattended (overnight)
  • Automation increases  speed of test execution
  • Automated testing can simulate tens, hundreds or thousands of virtual users interacting with a network, software and web applications.

Helps increase Test Coverage

 

  • Test coverage in particular, is a measure of the extent to which the code in question has been tested by a particular test suite
  • test coverage is a useful tool for finding untested parts of a code base.
  • Manual Testing can become boring and hence error prone.

Early Feedback

 

 

In agile context

Test automation provide early feedback, if automated tests own by both developer and tester
Test can be run on each code change.
Collaboration of developer and tester due to automation improve moral of team as well as individual

 

When and What to automate? 

In any project life-cycle, our goal should be to automate all the activities that are repeated while creating and maintaining the system

so what are repetitive activities?
  • Set up test data
  • Executing same tests on different or cross environments
  • Regression testing 
Our focus should be to create a high value test suite, which focuses on the business critical areas of our product.

 

Saturday, February 27, 2016

Locators in selenium webdriver

Lets understand locators by asking WH questions.

Locators in selenium
Click on the image to enlarge it
What are locators ?
  1. Locators are the lifeblood of the tests.
  2. Locators are different strategies for locating elements on a page
  3. Locator can be termed as an address that identifies a web element uniquely within the webpage.
  4. Locators are the HTML properties of a web element. 

When and Why they are required ? 
  1. To tell the Selenium about the web element it need to perform action on
  2. To tell Selenium which GUI elements ( say Text Box, Buttons, Check Boxes etc) its needs to operate on.
  3. To get information of an element

Who are they ?
  • Id 
  • Name
  • Linktext
  • Partial Linktext
  • Tag Name
  • Class name
  • Css selectors
    • selectors are patterns used to select the element(s) you want to style
    • is the part of a CSS rule set that actually selects the content you want to style 
  • XPath expression
    • document is parsed into a tree structure (DOM tree)
    • for selecting nodes from a document
    • is used to navigate through elements and attributes in a document.
Where are they in selenium web driver? 
  • abstract class By inside the package org.openqa.selenium
  • subclasses of By and interfaces
How to use locators, to find elements with different locator strategies ? 
  • Using developer tools available in browsers
  • Right-click --> Inspect Element or Inspect (Firefox / Crome)
  • Using browser add-on like this 
  • Example: 
    • <input name="register" class="required" type="text"/>
    • WebElement register= driver.findElement(By.name("register"));
 Which locator strategy to use?
  • There is no perfect locator
  • If you’re smart about your locators you can reduce the cost of maintenance
References
  1. http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/By.html
  2. http://www.seleniumeasy.com/selenium-tutorials/selenium-locators
  3. http://toolsqa.com/selenium-webdriver/locators/
  4. http://www.guru99.com/locators-in-selenium-ide.html