Sunday, June 1, 2014

How to explain the framework to the interviewer.

In our project Your_Project_Name (ex- CustomerCentre) , we are using Hybrid Framework(why framework required) which is the combination of Data Driven, Method Driven and Modular Driven Framework. Basically this involves 3 stages-

1) Designing the framework,
2) Implementing the framework,
3) Execution of the framework.


1) Designing the framework-

 

a) while designing the fw in anyone of the local drive create a folder by name HybridFramework. Launch the eclipse, set the workspace to HybridFramework.
b) in eclipse create a java project by name CustomerCentre.
c) in eclipse under CustomerCentre proj create a folder Jars & to that Jars folder include all the jar files related to the project such WebDriver jar, poi jar etc.
d) in eclipse under CustomerCentre proj create another folder by name Drivers to this folder copy all the executable files or driver such as Chrome Driver, IE driver and so on.
When designing the framework there are methods which can be used in more than one project such methods we call it as Generic method. And there are methods which are related to only one single project those methods are called as project specific method.
Naming convention for package- com.projectname.packagename (com.CustomerCentre.Library)
All the methods related to Generic, we write them under GenericLibrary class which is present in the Libraries package. And all the project specific methods are written under ProjectSpecificLibrary class which is present under libraries package.
All the GenericLibrary method should be public as well as static. Like – getLastRowNum, getCellValue, setCellValue, etc.
In the application there are certain types of steps which has to be used again & again such as open browser, open application & so on. In order to handle these types of steps we create ConfigLibrary (SuperTestNG) class in which we have written the methods by using Selenium annotations like @BeforeMethod, @AfterMethod etc. so that we need not to write the code for repeating steps each time. Inharit this class from all other classes to use these class methods.
We create an excel file by name Config, in which we wrote all the input data for the testing and then copy the entire excel file, and paste it under the CustomerCentre project.
To confirm everything working fine or not, we create a dummy package with dummy @Test method. If browser is getting launched, app is getting launched & browser is getting closed i.e. whatever we have developed till is correct. Then delete the dummy package.
To perform the validation, we create one more class Assertion. Whenever we need to perform validation we need to call assertText() or assertTitle() present under the Assertion class. (Assert.assertEquals())
 

2)- Implementing the ProjectSpecificLibrary- 

 

This is where actual implementation of the framework start. While going thru the manual testcases we note down the common repeated steps and make those steps as a project specific methods. Even if one step is repeating , may be in same testcase or other testcase make it as a method. Then write the test script for all the manual test cases.

 

3)- Execution-

 

 Right click on the project, navigate to TestNG → convert to TestNG → give the proper suite name and test name and click on finish. Then execute this xml file (ctrl+f11) or right click and run as TestNG Suite. Or to run thru cmd → navigate till project then give this commnd-

java -cp bin;jars/* org.testng.TestNG testng.xml


Explain with the below diagram that will be more impressive.


21 comments:

  1. superb explanation... Thanks a lot.........

    ReplyDelete
  2. Very helpful.....thanks a lot....

    ReplyDelete
  3. Very good though to explain in a systematic approach. Big clap.

    ReplyDelete
  4. It would be good if you could add the sample project under which you are explaining assertText() or assertTitle() etc. It will help deeper to understand the thought process.

    ReplyDelete
  5. @Amit , please find the project here which is developed with POM framework which is better than hybrid framework.

    http://selenium-makeiteasy.blogspot.in/2014/06/page-object-model-pom-with.html

    ReplyDelete
  6. Hi Sanjay,

    Very good explanation i struggled lot to explain the frame work in interview, every time (Since 3months) i failed. Hope this time i will crack the interview.

    ReplyDelete
  7. Hi Sanjay,

    In the above diagram can you please explain me about Module 1,2,3.xml and module test 1,2,3. What kind of test cases written in this module. I am bit confused how it is interrelated. How to explain this flow in interview according to diagram.

    ReplyDelete
  8. Hi Sanjay Kumar Soni Ji,Thanks a LOT for the wonderful explanation.Please keep up the Good Work.May GOD BLESS YOU...

    ReplyDelete
  9. Hi sanjay very good explanation , i failed 2 times to explain in interview, this time i can make it .Thnx a lot, better make video of it ,s o that it will be more useful

    ReplyDelete
  10. Hello Mukund, there is no 4rth step i mentioned.
    Execution means to run the script. After executing the script you will get the execution report with passed and failed test cases. That's all.

    ReplyDelete
  11. Thanks . And one more thing if in config file has the steps which is going to get repeated what would be in project specific libraries. Because i taught that URL and other login details would be in project specific? So it would be good if you can give me the example in project and config lib

    ReplyDelete
  12. Please have a look here in the code and framework structure (It is also a kind of hybrid framework)- http://selenium-makeiteasy.blogspot.in/2014/06/page-object-model-pom-with.html

    ReplyDelete
  13. I want to become a automation tester please suggest me recently I am working as a manual tester last 1 year please suggest me entry level study so that I can explore my skills day by day
    thanks
    nitin

    ReplyDelete
  14. Sir ,Can you please explain module1.xml,module2.xml,module.xml, what is the purpose of that,they are object repository?

    ReplyDelete
  15. soooper amma. keep up the good work. Your support is appreciated

    ReplyDelete
  16. Superb Sanjay...Keep the good work going...

    ReplyDelete
  17. Thx a lot Sanjay... very clear cut points and easy to understand...

    ReplyDelete