Modular Driven Framework
Required knowledge : Page Object Model
In most of the web application we have few set of actions which are always executed in the series of actions. Rather than writing those actions again and again in our test, we can club those actions in to a method and then calling that method in our test script. Modularity avoids duplicate of code. In future if there is any change in the series of action, all you have to do is to make changes in your main modular method script. No test case will be impacted with the change.
How to do it..
Look for repeated functionality in your application for example the ‘login’ functionality. We can simple wrap this functionality in a method and we can give it a sensible name.
1) Create a ‘New Package’ file and name it as ‘userAction’, by right click on the Project and select New > Package. We will be creating different packages for Page Objects, Utilities, Test Data, Test Cases and Modular actions. It is always recommended to use this structure, as it is easy to understand, easy to use and easy to maintain.
2) Create ‘New Class’ and name it as SignIn by right click on package ‘userAction’ and select New > Class. It will add new class ‘SignIn’ under package ‘userAction’.
3) Now create a Public Static Void Method and name it as Execute and club the following steps in to it:
Load Page login Facebook
Enter Username
Enter Password
Click on the Submit button
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
4) Create ‘New Class’ and name it as PostStatus by right click on package ‘userAction’ and select New > Class. It will add new class ‘PostStatus’ under package ‘userAction’.
5) Now create a Public Static Void Method and name it as Execute and club the following steps in to it:
Enter Status
Click on button Post.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
Post a Comment
Post a Comment