Friday, November 18, 2011

Cucumber Installation

Below are the steps to install cucumber on the system -

  • Go to http://railsinstaller.org/, download and install Kit on C:\railsinstaller after installation go to command prompt and type 'ruby -v'. It will show the ruby help.

  • Run 'gem update --system' command on command prompt.

  • Install following gems:
    1. gem install cucumber
    2. gem install rspec
    3. gem install watir
    4. gem install activerecord
    5. gem install factory_girl
    6. gem install database_cleaner
    7. gem install win32-clipboard
    8. gem install ruby-odbc
    9. gem install activerecord-sqlserver-adapter
    10. gem install faker
    11. gem install chronic
    12. gem install win32console
    13. gem install prawn
    14. gem install roo -y

Thursday, November 17, 2011

Cucumber


  • Cucumber is one of the implementation of Behavior Driven Development.

  • It is a tool that executes plain-text functional descriptions as automated tests.

  • It is Ruby based.

  • In it user describe the behavior of the system with natural language with some specific keywords (Given/And/when/Then).

  • The process start with creating feature files (easy update-able plain-text files explain a feature of the system and some scenario of different test situations).

  • Cucumber doesn't know how to interpret the features by itself.

  • To interpret the features creation of step definition is required which are written in Ruby.

  • Cucumber can also be combined with a web automation framework like WATIR.

  • Cucumber can generate reports in various formats, including HTML, PDF and color text on the screen.

  • The language that Cucumber understands is called Gherkin.

Wednesday, November 16, 2011

Behavior Driven Development (BDD)


In BDD :

  • Tests are described in the natural language.

  • It makes the test more accessible to people outside of development or testing team.

  • It can describe the functionality as specifications.

  • It is an Agile software development.

  • It encourages collaboration between developers, testers and non-technical or business participants in a software project.

Tuesday, November 15, 2011

Important Terms In Cucumber


  • Ruby Gems         : It is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems,and a server for distributing them.

  • wscite                  : Text editor for ruby.

  • ninja                    :  It is a type of cucumber in USA.

  • prawn gem          :  These are pure ruby files for generating PDFs.

  • win32console       :  To get color reports. 

  • rspec                    :  It is a rails plugin  that brings Rspec to Rails

  • RubyMine           :  It is an IDE for Ruby and Ruby on Rails. 

  • Ruby on Rails     :  It is an open source web application framework for ruby. 

  • win32ole library  : automating Internet Explorer (IE) with Ruby using the win32ole library.  

Monday, November 14, 2011

Execute a test in Cucumber

Use the below steps to execute a test in Cucumber:

1. Open the commond prompt in ruby & rails.

2.  Reach at the particular folder where test is stored.

3.  Type cucumber.

Note :


We can use tagging to execute a particular feature file or a particular scenario.

  • To run only scenarios with a certain tag we pass Cucumber -t option and the name of the tag.
            cucumber features  -t focus

  • To run all of the scenarios except the ones with a certain tag we place a tilde before the tag name.
           cucumber features  -t ~focus

Sunday, November 13, 2011

Test Automation Tool Selection


The process of determining which tool will best be suited to our needs is not an easy one. Each organization will have different needs that should be met by software test automation, which will be complicated by the various applications to be tested and operating systems used.

The steps to software test automation tool selection are as follows:

1. Determine our requirements
    
    These are some of the important questions we will need to ask.

Ø  Compatibility issues
                   Any testing tool we choose will need to be compatible with:
ü  The operating systems our application supports
ü  The development environments used to create our application
ü  Third party software with which our application integrates

Ø  Tool audience
ü  Who in our organization will be using the tool?
ü  Will our organization allow for staff training?

Ø  Business requirements
                     Vendors need to conform to certain requirements before they can become suppliers to the organization.

Ø  Testing requirements
                  What types of testing problems do we want the tool to address?
ü  Manual testing problems
ü  Time constraints
ü  Shorter regression testing timeframes
ü  Test data setup
ü  Defect tracking

2. Identify our constraints

 These factors will allow us to exclude certain tools from our selection process at an early stage:

Ø  Environmental constraints
This category will include hardware and software constraints. Consider the operating systems the tool needs to work on as well as the hardware requirements for the tool.

Ø  Should the tool be co-resident with test applications?
This needs to be considered to ensure future use of the test automation software.

Ø  Supplier constraints
ü  Is the supplier a bona fide company?
ü  How mature is the company and their product?
ü  Do they have adequate technical support?
ü  How many other organizations have purchased the tool?
ü  What is the history of the tool?

Ø  Quality constraints
ü  Skill level required to use the tool
ü  Multiple user access
ü  Support and help documentation
ü  Integration with other tools
ü  Frequency of failure during realistic use

Ø  Budget constraints
Keep in mind that the budget amount available will have to cover the purchase of the tool as well as licensing, training and implementation costs for the use of the tool. The cost of the tool will also directly affect our Return on Investment (ROI) calculations in the proposed business case to management.

3. Compile a possible list of candidates

Ø  Feature categorization:
ü  Mandatory features: These are the features that are essential to accomplish our goal in meeting our requirements within the constraints.
ü  Desirable features: These are features that will distinguish the best tools from the others.
ü  Irrelevant features: Features that are not important and will not provide any real benefit to our situation.

Ø  Rate these features.
                  This may be an iterative process.

4. Make selection

Ø  Feature comparison
Our feature list will allow us to compare the tools in terms of performance of the features advertised in marketing material against the requirements of our own system.

Ø  In-house demonstrations
                 We can ask vendors to perform an in-house demonstration on our system.

Ø  Test of script maintenance
It is important to evaluate how easy it is to maintain the automation scripts on these tools.

Ø  Competitive trial
      Run all our tests on each of the tools on our short list using the same test applications. This might require more work from our side, but will give us a very good idea of how each tool compares against the others.

Sunday, May 22, 2011

Automation Framework


An automation framework is a set of guidelines like:
  • Coding Standards , 
  • Test data handling , 
  • Object repository treatment etc. 
Which when followed during automation scripting produce beneficial outcomes like:
  • Increase code re-usage , 
  • Higher portability , 
  • Reduced script maintenance cost etc. 
These are just guidelines and not rules, they are not mandatory and we can still script without following these guidelines but we will miss out on the advantages of having a Framework.


Available Automation Frameworks:
  1. Linear Scripting.
  2. The Test Library Architecture Framework.
  3. The Data-Driven Testing Framework.
  4. The Keyword-Driven or Table-Driven Testing Framework.
  5. The Hybrid Test Automation Framework


Hybrid Test QTP Framework


  1. This framework is the combination of one or more frameworks.
  2. Pulling from their strengths and trying to mitigate their weaknesses. 
  3. This hybrid test automation framework is what most frameworks evolve into over time and multiple projects. 
  4. Maximum industry uses Keyword Framework in combination of Function decomposition method.

Keyword Driven QTP Framework


It is also known as "Table Driven Testing Framework" or “Action Word Testing".

This Framework,
1.      Requires the development of data tables and keywords, independent of the test automation tool used to execute them.
2.      Tests can be designed with or without the Application.
3.      In a keyword-driven test, the functionality of the application-under-test is documented in a table as well as in step-by-step instructions for each test.


Components in this framework,
  1. Control File (Scenario Sheet).
  2. Test Case File.
  3. Startup Script (Environment Sheet)
  4. Driver Script.
  5. Utility Script. (VB Script Functions)

Ø       Control File (Scenario Sheet)
a)      It consist details of all the Test scenarios to be automated.
b)      User will be able to select a specific scenario to execute.
c)      Control File is in the form of an excel worksheet.
d)      It contains columns for Scenario ID, Execute (Y/N), Object Repository Path,   test Case File path.

Ø       Test Case File 
a)     It Contain the detailed steps to be carried out for the execution of a test case.
b)      It is also in the form of an excel sheet and contains columns for Keyword, Object Name, Parameter.

Ø        Startup Script (Environment Sheet)
a)     The startup script is utilized for the initialization and reads the control files.
b)     It’s a place to declare global variables & paths.
c)     It then calls the driver script to execute all the scenarios marked for execution in the control file

Ø       Driver Script
a)     It Reads the Test Case files.
b)     Checks the keywords and calls the appropriate utility script functions based on specific keyword.
c)     Error Handling is taken care of in the driver script.

 
Ø       Utility Scripts (VB Script Functions)
a)     Perform generic tasks that can be used across applications.


Advantages:
     1.      Provides high code re-usability.
2.       Test Tool Independent.
3.      Independent of Application under Test, same script works for AUT (with some limitations).
4.      Tests can be designed with or without AUT.

Disadvantages:
  1. Initial investment being pretty high the benefits of this can only be realized if the application is considerably big and the test scripts are to be maintained for quite a few years. 
  2. High Automation expertise is required to create the Keyword Driven Framework. 

Data-Driven QTP Framework.


In this Framework,
  1.  Test case logic resides in Test Scripts.
  2.  Test Data is separated and kept outside the Test Scripts.
  3.  Test Data is read from the external files.
  4.  The external files may be Excel Files, Text Files, CSV Files, ODBC Sources, DAO Objects etc)
  5.  The external files are loaded into the variables inside the Test Script. 
  6.  Variables are used both for Input values and for Verification values.
  7.  Test Scripts themselves are prepared either using Linear Scripting or Test Library Framework.
Advantages:
  1.  Changes to the Test Scripts do not affect the Test Data.
  2.  Test Cases can be executed with multiple Sets of Data.
  3. A Variety of Test Scenarios can be executed by just varying the Test Data in the External Data File.
Disadvantages :
  1.  More time is needed to plan and prepare both Test Scripts and Test Data.

Example :

Developing  Login script using this method will involve two steps.

 Step 1) Create a Test - Data file which could be Excel , CSV , or any other database source.
  
Username                 Password
Ankur                        Password1
Ankit                         Password2
Ashu                         Password3 

  
Step 2) Develop Test Script and make references to  test data source.
  
Dialog("Login").WinEdit("Username:").Set DataTable("Username", dtGlobalSheet)

Dialog("Login").WinEdit("Password:").Set DataTable("Password", dtGlobalSheet)

Dialog("Login").WinButton("OK").Click


Saturday, May 21, 2011

Test Library Architecture QTP Framework.


It is also know as "Structured Scripting" or "Functional Decomposition".



In this Framework,


  1.  Test scripts are initially recorded by “Record & Playback” method. 
  2.  Common tasks inside the scripts are identified and grouped into Functions.
  3.  These Functions are called by main test script called Driver in different ways to create test cases.


Advantages:

  1. Higher level of code reuse is achieved in Structured Scripting as compared to “Record & Playback”.
  2. The automation scripts are less costly to develop due to higher code re-use.
  3. Easier Script Maintenance(Common functionality need to modify at one place only). 

Disadvantages:

  1. Technical expertise is necessary to write Scripts using Test Library Framework. 
  2. More time is needed to plan and prepare test scripts. 
  3. Test Data is hard coded within the scripts(data tables are not used). 

Example:


Function for logging in to an application will look like:

Function Login()

Dialog("Login").WinEdit("Userame:").Set "Ankur"

Dialog("Login").WinEdit("Password:").Set "Password1"

Dialog("Login").WinButton("OK").Click

End Function 


Now, we can call this function in the main script as follows

'Driver Script

Call Login()


Linear Scripting QTP Framework


It is the simplest of all Frameworks and also known as "Record & Playback".


In this Framework,
  1.  Tester manually records each step (Navigation and User Inputs).
  2.  Inserts Checkpoints (Validation Steps) in the first round. 
  3.  Plays back the recorded script in the subsequent rounds.

Advantages:
  1. Fastest way to generate script (No programming is required at all).
  2. Automation expertise not required.
  3. Easiest way to learn the features of the Testing Tool.

Disadvantages:
  1. Little reuse of scripts (functions are not used).
  2. Test data is hard coded into the script (Data table is not used).
  3. Maintenance Nightmare (If the requirement/test data is changing very frequently then it’s very difficult to modify).

Example:


Consider logging into an application and checking whether the application has loaded on successful log-on. Here, the tester will simply record the steps and add validation steps.


Dialog("Login").WinEdit("Username:").Set "Ankur"

Dialog("Login").WinEdit("Password:").Set "Password1"

Dialog("Login").WinButton("OK").Click

Saturday, April 30, 2011

Search This Blog