This can be explained as a Challenging Scenario in interviews as below:
“UI-DB validation: I faced a scenario where I had to fetch the account numbers from the UI application and I had to validate that the accounts which are displayed in the UI page is matching with the corresponding data base table.”
Use existing Cucumber Frame work to do this test case. FW kept here:
Note: try to do this on your own using the existing framework. DB methods are already part of the framework so you have to reuse them. Some of the step defs in below feature file is already implemented, so check which step defs is not there and only implement them.
I will provide the solution in couple of days.
Feature file to be Automated.
Feature: validate account in parabank UI matches with DB accounts table
Background: Pre Requsite to open browser and sign in
Given As a user when I launch application in "chrome"
And navigate to url as "http://parabank.parasoft.com"
When I enter user name as "john"
And I enter password as "demo"
And I click submit button
Then I should be logged in to the application with title as "ParaBank | Accounts Overview"
Scenario: validate the account
When I fetch all the accounts numbers from account overview page for user "John"
And I fetch Data from DB using "Select acc_number from ParaBankAccounts where customer_name ='john'"
Then I validate account number in parabank matches with DB accounts table values