Monday, 13 April 2015

Selenium with OCR Technology for Image Verification With Text

Agenda for this blog:To discuss the verification of IMAGE in Selenium c# with the OCR technology.

What is OCR:Optical character recognition (OCR) is the mechanical or electronic conversion of images of typewritten or printed text into machine-encoded text.It is a common method of digitizing printed texts so that it can be electronically edited, searched, stored more compactly, displayed on-line, and used in machine processes.

Where and When OCR technology is required for Selenium:

When we are automating our application with Selenium and C# as a language.There  might be some scenario where we need to verify images,In this type of situation tampering images won't give good result,and also Selenium c# is not that much compatible with SIKULI which does a decent job for Selenium JAVA in this kind of image processing/verification etc etc. There OCR technology comes in to the picture which serves the purpose well.

What we can Do with OCR:
We can extract text from the images and can verify the same from our Selenium C# application Under test.

HOW:
           We need to download the required image locally and perform the action in following two ways:

A. Using "https://www.newocr.com/" we can upload the image and can extract the text from the image.

B. Using "tesseract-ocr"  we can achieve the purpose very well.


What is Tesseract-Ocr:

Tesseract is probably the most accurate open source OCR engine available. Combined with the Leptonica Image Processing Library it can read a wide variety of image formats and convert them to text in over 60 languages.

How: We need to install tesseract-ocr in our system and through cmd prompt we can extract text from the image.



Visit for More Automation Related Discussion:

https://www.youtube.com/channel/UCKSk4gkmO3LXcW17hFUkmcQ/videos






Saturday, 11 April 2015

SpecFlow-Cucumber for .NET & Selenium with C#

Agenda for this Blog: To discuss about SpecFlow which is Cucumber for .Net.

SpecFlow supports the concepts of Acceptance Test Driven Development (ATDD) and Behaviour Driven Development (BDD), which are often used synonymously filling the gap between domain experts and Developers by binding business readable behaviour specifications,it uses  Gherkin.

What is Gherkin:
Gherkin is the language that Cucumber understands. It is a Business Readable, Domain Specific Language that lets you describe software’s behaviour without detailing how that behaviour is implemented.

Gherkin Syntax example:

Feature: To Cover regression of some application
                and its business values
 
        Scenario:   To test the Login Scenario
          Given           User needs to be on the Login Page of the Application
          And               some other precondition
          When           enter text as Username and Password
          And               click on the sign in button
          Then             verification of the login (Such as Home page should be displayed)


Which Unit Test Provider is acceptable :

We can use Unit Test Provider  as per the  need and choice such as we can use NUNit,MsTest or we can use SpecRun along with SpecFlow to run our Test Scripts.


Unit Test Provider can be configured in app.config file in the Unit Test Project like:

<specFlow>
  <unitTestProvider name="SpecRun" />
</specFlow>


We need to create separate feature file and we need to use gherkin syntax there,we can generate the the step definition for the same and we need to incorporate the Selenium C# code for writing Test Script.

Sample for SpecRun Report:







Visit for More Automation Related Discussion:

https://www.youtube.com/channel/UCKSk4gkmO3LXcW17hFUkmcQ/videos