Showing posts with label Hybrid driver framework.. Show all posts
Showing posts with label Hybrid driver framework.. Show all posts

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.