My Blog List

Friday, July 20, 2012

What is Framework?

Today, I am going to discuss about framework due to request of my friend Anand.

Lot of QTP guys know the information on How to Create Test, How to identify Complex objects, How to generate results and etc. But still somebody have doubts like
What is Framework?
Why we need Framework?
What's the purpose of it?
How to design framework?
Is that required lot of coding knowledge?, etc.

Let's consider a case. We have 100 test scenarios to automate. Each test scenario have around 100 test cases. Here you will do the following....
1. Create Test Scripts for each case by creating separate actions.
2. Each test case script i.e. each action will have associated resources. - Object Repository, Function Library and Recovery Scenario files.
1. You will have own driver script.
2. This will call each action one by one.
1. If any UI changes happened, you need to find the particular OR file to update the same.
2. You need to maintain lot of OR files which is a tough task.
3. If any new resource joined in Team, its tough task to give KT and to get on track.

So, you have lot of drawbacks in your script generation, execution and mainly on Maintenance phase. This will not give estimated ROI for clients. So,
1. How to reduce these complexities?
2. How to make our task easy?

Here we go...
Framework - Framing our work. How we are framing our automation work i.e. Script Design, execution and maintenance of our automation project which will yield good results on below points.
1. Easy script generation.
2. Maximum Re-Usability.
3. Low maintenance cost.
4. Easier execution of scripts for every new builds based on our decisions.
5. Ability to design test scripts using Non-Technical testers, Business Analysts, etc.

Let's design a sample framework for QTP for the same case we talked above.
Framework Design:
1. Let's create some folder structure which will help us to keep our files in respective folder. This will help a lot while our project grows.
2. Create a folder "MyApp-Automation" - Under this folder,
       Create a folder "Function Library" - Under this, maintain all our function libraries like .vbs, .qfl    and .txt files.
       Create a folder "Object Repository" - Under this, maintain OR files. Create a Shared OR for different modules or Create a Shared OR for each application.
       Create a folder "Data Files" - Under this, maintain all test data excel files, Scenario files, Test Cases files, etc.
       Create a folder "Config Files" - Under this, maintain all configuration files whether in .ini or .xls format. Maintain all the data required globally for execution of any test in these files so that we can read and set these values as Environment Parameters to access through out our execution scope.
       Create a folder "Results" - Under this, export our results after execution by creating a subfolder with name as "MyTest_CurrentDate_Time".
Test Design:
1. First identify the available functionalities, test cases and flow of business. Based on your analysis, design some re-usable functions like Login, CreateTxn, DeleteTxn, Logout, etc.
2. Then go and create Test Case Script. Here just you can use all your re-usable functions already written. No need to write again and again code for same functionality. This will reduce your script design time as well as maintenance time.
1. Add a field "Execute?" in your TestScenarios file and mark as "Yes/No" based on your execution requirement.
2. The same way, add this field for TestCases sheet and mark as Yes/No.
3. Now design your DriverScript like,
   a) Read the Test Scenarios file.
   b) Check Execute field. If Yes, goto TestCases file for this TestScenario.
   c) Read TestCases. If Yes, execute this case. i.e. Call the function for this case like "Call TS1_Case_001". Here Case_001 is the function for your TestCase TS1_Case_001.
   d) The same way, it will loop for all cases under the Test Scenario and then will pickup and loop for all Test Scenarios.
4. So, the only initial point is your Driver Script after setting up your requirement for execution and test data.
1. Here you have minimum number of OR files based on application or modules. So if any UI changes happened in application, its easy to find and update values.
2. Also, if any functionality is changed in your application, just go and modify in your re-usable function. That's enough, it will affect all the cases as the re-usable function only called inside all the cases. No need to open each case and modify.
3. Even manual testers or business analysts can design test script because we have ready made functions for all functionality. Only thing they should know, purpose and use of each re-usable function which we can deliver by creating a documentation.

For the types of frameworks, you will find lot of resources in web. Just Google it. Just providing the main types available.
1. Keyword-Driven
Our designed re-usable functions are Keywords.
2. Data-Driven
Your test data is driving your test. i.e. Your single test will run multiple times with different data each time.
3. Hybrid
Any combinations for more than one kind of framework.

So, I hope now you might have some idea about framework and you might be in the position to answer all the questions I have listed on top.
Why are waiting? Start creating your framework now !!!

Here are some links:-

1 comment:

  1. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium