QTP Functional Decomposition Framework ? Advantages and Disadvantages ?

[Note: Before we begin explaining the Modular Framework, let us first revisit the most important disadvantage of linear framework. The most important disadvantage of linear framework is that it lacks re-usability. This lack of re-usability can be classified into 2 types - 

Lack of Code Re-usability: Since the code in the Linear Framework in written step by step in a linear manner, you can’t really reuse it at different places without copy pasting it. We use modular framework approach to overcome this shortcoming of linear framework.


Lack of Data Re-usability: You have this limitation in Linear Framework because the data is hard-coded within your script. Hence we can’t use the same code with multiple data values. You can overcome this shortcoming by using Data Driven approach.]

QTP Modular Framework (also known as Functional Decomposition Framework) is the approach where you first identify the re-usable code from your test cases. Then you write this re-usable code inside different functions and call these functions wherever required. The advantage of this approach is that the re-usable code would always stay at one place and thus it would be easy to maintain the code because you would have to make the changes at a single place only. To re-use this piece of code, all you have to do is call the function wherever required.

The only challenging part here is to identify the reusable portions in your test case flow. Once that is done, you have to just create functions and use it wherever required. Let us see an example which would help you understand this concept more clearly.
Consider this scenario where you have to automate 2 test cases. In the first test case, you have to login to the application, create an order and then logout. In the second test case, you have to again login, then you have to modify an existing order and then logout.
Can you identify the re-usable flows from the above 2 test cases? Yes, from the above test cases we can clearly see that there are 2 different re-usable flows that are used in both these test cases – Login and Logout. Let’s see how the flow would look like in the Modular Framework approach.


'- - - - - Login Function - - - - -
Function fnLogin()
  'Open Application
  'Enter Used Id and password
  'Click on Login button
  'Verify successful login
End Function

'- - - - - Logout Function - - - - -
Function fnLogout()
  'Logout from the application
  'Verify Logout is successful
  'Close the application
End Function

'===== Test Case 1 - Create Order =====
'Call Login function
fnLogin()

'Code to create order
' ..........
' ..........
' ..........

'Call Logout function
fnLogout()

'===== Test Case 2 - Modify Order =====
'Call Login function
fnLogin()

'Code to modify order
' ..........
' ..........
' ..........

'Call Logout function
fnLogout()


QTP Modular Framework – Advantages and Disadvantages


Advantages

1) The amount of time spent on coding is lesser as you are creating re-usable functions and calling them wherever required.

2) Script maintenance is relatively easier because the re-usable code is available at a single place only no matter how many times it is called. If there is a change in any re-usable function, you would be required to make the changes at only one place.

Disadvantages
1) Additional time spent in analyzing the manual test cases to find out the reusable flows. This is not required in linear framework.
2) Users need more technical expertise in automation to work on modular frameworks.
3) In case you use only modular framework, the data will still be hard coded in the script only. So you can’t use the same test script for multiple data without changing the values before each run.

NOTE: The main issues with linear framework were lack of code re-usability and data re-usability. QTP Modular Framework solves only one of these limitations. The other limitation (data re-usability) still looms large. So, you cannot use QTP modular framework alone in many of your automation projects (especially if your test cases need to be validated against multiple sets of data). To work on any real life automation project, you should really be looking at using a combination of QTP modular framework + data driven framework.




To receive daily posted JOBS & Interview Questions
Just enter your email address below and click 'Submit'
Enter your email address:

Make sure to activate your subscription by clicking on the activation link sent to your email