Wednesday, May 11, 2011

Automation Framework & It's Type


Friends, one of my regular blog reader asked “What exactly Automation framework is”?   She was new to automation and while goggling the same she was confused the basic definition.  So I thought to share my understanding in simple words.  Please free to correct me at any point.
Let’s take it by word itself “Automation Framework”
Ø         
        Automation:  To automate a manual task
Ø          
         Framework:  Framework in general words it is outline structure or Master which control complex process or we can say control the execution for various child process.

For testing, automation framework is just combination Master and slave script where master script which control execution of your test (Slave scripts). Nothing more than that.  Now the type of automation framework depend on you how you want to implement test and your requirement. It also depends on type of test like business scenario, functional test, regression (Same functional test with different set of data).
 Type of automation also depend on the parameters like scope of testing, depth of testing, visibility of product enhancement or further development,  product may be developed in more than one technology. In short answer of the question “What we expect from automation”.
Well basic thing is application should be stable and if there is any change you should be well aware of that before planning, designing & implementation of the same.  Of course we can’t get visibility of the all parameter in real environment but we should try to cover as much as possible.
Master scripts:
Ø    
            Master script is the script from where we start our execution.  This script will take care of configuring the test environment and ensure the same before executing and test cases and at the end collect the all the result & log and provide them in required format to  end user.
Ø    Configuration of test environment include number of things like production install, verify required version AUT and supportive application, loading test case and test data, updating registry or other  system parameter, etc which we can handle  by calling function for different activity. 

Type of automation framework:
 These types are not specifically decided but these are most possible ways of implementation depending on your requirement.   
1.      
           Data Driven:

Ø  When you have the functional test case with different set of data one can use this approach.
Ø   In this approach we write the scripts/Function for each functional test where we pass the different set of data as input and expected output is compared as criteria of test case to pass & fail. 
Ø  Also there will be common function which we will be using in different test.

2.      Keyword driven

Ø  We take this approach when we have number of test case which we can divide them in number of steps and many of the steps are common in different test.
Ø  And we take each step as different “Keyword”. In this framework we maintain the test case and input data in excel. 
Ø  Implementation of this type of framework includes 4-5 level of hierarchy in execution.
1.       First level will be master script to set test environment call the second level.
2.       Second level will read the excel and  decide which module is set for execution and depending on that it will load required functional library, object library, test data ,etc and pass the call to Third level
3.       Third level will read the excel for respective module select in second level and load the test case and pass the call to fourth level
4.       In fourth level we read keyword of test cases and execution them one by one.
Ø   Here there will for loop in 2nd, 3rd & 4th level which will make sure all the module and respective test case are executed.
Ø  Logging of result and generating the final report we can decide as per our requirement. Handling of exception, error, passing  & failure condition, moving to next test when current one is failed are implemented in each level as per requirement.
Ø  Numbers of level completely depend on your application & number of test case and scope also.
Ø  But make sure to keep thing s independent which will be easy to debug, identify the issue and to make any big change in framework in future. It will be also easy to understand.
Ø    Implementation of key driven framework required lots of planning,   knowledge of domain and application and visibility of possible risk in term technical implementation.

3.       Modular driven:

Ø  This type approach is taken when different kind of test case for different module or we want to business scenario specific to module
Ø  Here we prepared the single script for each module which will execute independently from other.
Ø  Here we can also remove the master script and run the each module independently and to run module in single script we can have sort of wrapper script which will just control the sequence of execution
Ø  Environment configuration, test data, result, error handling all these are handled in module scripts itself.
 
4.       Hybrid:

Ø  Hybrid is combination of keyword and data driven framework. And as per my experience most of keyword driven and converted to hybrid at the end of implementation.

Basic Parameters of Framework

·         Configuration file:   This can be file or a function which will take care of configuration of test environment before execution. It will install, verify the required version of AUT and supporting application.  To test thing on multi OS booting from OS to anther can also be the part of Configuration.

·         Make base state: This function will take care to set AUT in required/base after any failure and exception occurred. We can call this function after each failure.

·         Global/Environment Variable: This file include the entire global variable which are very frequently used in automation like application/library path, results path, failure detail (Video/Snap), test data path, test cases path, etc.

·         Reusable: This file will contain all the reusable application independent function. For example string/Table/excel comparison, loading excels file, converting string to specific format, split the string, write into excel or test file, etc.
  
·         Common function:  This file will contain all the common function which specifically developed for application like select combo box item, verify or select tree item, etc.
 
Friends I have try to give basic idea about automation framework to beginner as per my experience. Please feel free to correct me if I am wrong at any point or if you have any query  by putting comment on blog or drop me a email @ deepakpesu@gmail.com
 Thanks

Monday, May 2, 2011

Verify Coloum exist in Datatable


 'Arguments Passed          : 1. objSheet -  Datatable object
'                                        2. strColumnName - Parameter name
'Return Value                    : True or False   

Function Fn_VerifyDataTableColumnExists(byRef objSheet, byval strColumnName)
    
     Dim intParamTotal
     Dim intIterator
     Dim intValue
    
     ' get total nbr of columns in datatable
     intParamTotal = objSheet.GetParameterCount
    
     ' loop all columns
     For intIterator = 1 To intParamTotal
    
          'get name of column
          intValue = objSheet.GetParameter(intIterator).Name
          
          ' compare if column name matches
          If strComp(strColumnName,intValue)=0 Then
           Fn_VerifyDataTableColumnExists=TRUE
           Exit Function
          End if
     Next
     Fn_VerifyDataTableColumnExists = False
    
End Function
 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | JCpenney Printable Coupons