Tuesday, 28 February 2017

Generate Extent Reports in SignInTest

In the previous post, we got some idea about the extent reports. Here we will implement the extent report in our test cases & will verify the report.
As of now I will introduce the extent report only for SignInTest & in next post onwards I will implement the same for other tests as well.
To generate the report, follow the steps below:

Adding Extent Reports to generate the test reports

In software testing the main important part is reporting where user can able to get the status of any test cases. If we are running the test cases through TestNG or Junit, then we get some html reports which are not so good. To avoid the same, we can use XSLT reports which have the reports generated in PIE chart but we can’t get the complete information about the tests. For better understandings, we can keep the test logs & the status in a single html file & the same can be achieved by using Extent Reports.

Monday, 27 February 2017

Add BaseTest class file to keep all the common functionality of Test Cases & remove hard coding

As you have seen in SignTest there are some code which is used to Open Browser & navigate to the URL. Similarly, there might be multiple test cases like RegistrationTest, CartTest etc. So instead of writing the same code to Open Browser & navigate to URL, we will add a BaseTest.java class file in our test cases & every test cases will extend to that BaseTest class.

Friday, 24 February 2017

Creating the Base Page & Top Menu classes

Let’s add a base page class which will contain all the reusability methods & each page class will extend the base class.
To create a BasePage.java, Right Click on com.demo.pom.pages > Click on New > Class > Insert the name as BasePage

Thursday, 23 February 2017

Add web driver code, page objects & share the same web driver across pages

In previous post, we had discussed about the challenges. Let’s 1st look onto how can we share same driver object across pages?
The answer to the above question is, we can implement Page Factory design patter in our project. In Page Factory Design pattern, we have a method, PageFactory.initElements(driver, LunchPage.class)
The above method will initialize the driver object in LunchPage class internally.
Let’s change the code as below & after that will explain the code overview:

Wednesday, 22 February 2017

Update the page class files.

For page classes, we have already defined the package & also added the class files for each page.
Let’s test with some basic data like printing the data in methods. Let’s take an example of SignInTest.
As previously mentioned, to sign in we need to lunch the browser > navigate to sign in page > insert valid details & click on signin button > It should navigate to MyAccountPage.

Add .xls File Reading Utility in Framework

In the previous post, we have added the required excel data sheet. Here, we will discuss how can we read data from excel sheet using apache POI.
For reading the excel data we should require the apache POI dependencies in our pom.xml file. Please check the below dependencies in pom.xml file: