Monday, 20 February 2017

Creating Required Class Files for Pages & Test Cases

Before we proceed with creating the class files, let’s take an example of a site  http://automationpractice.com/, where we will automate the Registration Flow, Login Flow, Add Product to Cart Flow.
Registration Flow:
To do the registration we need to open the browser, navigate to sign in page, insert email address, click on create account button, fill all the details, click on Register. If all are valid then it will navigate to my account page.
Please check the below flow diagram for registration work flow:


Login Flow:

Add Product to Cart Flow:


From the above flow diagrams, we got to know how to proceed with the flow & also we have the list of pages. As per the architecture of POM framework we need separate class file for each & every page. For our project, we need the below class files (page classes):
Right Click on src/main/java > Click New > Package > inert the package name as “com.demo.pom.pages”.
Now in com.demo.pom.pages package add the below class files:
·         LunchPage.java
·         SignInPage.java
·         RegistrationPage.java
·         MyAccountPage.java
·         ProductPage.java
·         CartPage.java
Note: To create the class files, right click on com.demo.pom.pages package > Click New > Click Class

Similarly, we need a package for the test cases & the class files for test cases. Please check the below steps to create the package & class files for test cases:
Right Click on src/test/java > Click New > Package > inert the package name as “com.demo.pom.testcases”.
Now in com.demo.pom.testcases package add the below class files:
·         SignInTest.java
·         RegistrationTest.java
·         Cart.java

After creating the above package structures, the project will be shown as below:



<<<Prev       Next>>>


No comments:

Post a Comment