Tuesday, 7 March 2017

Implement Test Case for Registration Workflow.

Let’s focus what we covered till now?
  1. Automated the Sign in workflow.
  2. Generated the logs.
  3. Added screen shots in logs file.
  4. Implemented the failure/skip of test case/test data.



By considering the above points are ready with our framework. Now we need to implement individual test scripts. Once we are done with all the test scripts we can check how to run multiple test cases from testng.xml file. We will discuss more about testng.xml later. As we have completed the Sign In workflow, here onwards will focus the automation of Registration work flow.
For Registration Test work flow, we have created the RegistrationTest.java class file for test cases & RegistrationPage.java file for storing all the elements.
As mentioned earlier we need to follow the below flow diagram for RegistrationTest workflow:

To implement the RegistrationTest & implementing some code optimization in SignInTest please follow the steps below:
  • Download the .zip file here & extract it.
  • Copy & Replace BaseTest.java, RegistrationTest.java & SignInTest.java files inside com.demo.pom.testcases package.
  • Copy & Replace BasePage.java, RegistrationPage.java & SignInPage.java files inside com.demo.pom.pages package.
  • Copy & Replace DemoConstants.java & TestDataProvider.java files inside com.demo.pom.util package.
  • Note: Open DataSheet.xlsx file > Open Data sheet > In row 15, Column D change the email address as it is already created.

After completing the above steps, right click on RegistrationTest.java > Run As > TestNG Suite & verify the result. Once registration test over, right click on SignInTest.java > Run As > TestNG Suite & verify the result.
Registration Test Result:


SignInTest Result:

Code Overview:
BaseTest.java
Here I have changed the return type of getErrorsContent method to get the total no.of errors.
RegistrationTest.java
Here, I have added the code for automating the Registration Workflow. If you are unable to understand the flow just comment below. I will try to explain the flow.
SignInTest.java
Here, we are initializing the actualResult value in each iteration & also changed the logic of web element to use getter & setter methods.
BasePage.java
Added the common web elements of each page. For now, I have added the errors xpath.
RegistrationPage.java
Added all the page objects Xpaths & also added the getter & setter method for each element. The getter method will return the object & the setter method will do the operation on that we element.
SignInPage.java
Added the getter & setter methods for Sign in Page objects.
DemoConstants.java
Added the Xpaths of Registration Page objects.
TestDataProvider.java
            Added @DataProvider for Registration Test.


<<<Prev       Next>>>

1 comment:

  1. i would like to share best automation testing services near you
    visit-https://www.dynamisers.com/automation-testing/

    ReplyDelete