What is the objective?
We will write a Scenario to verify login functionality on QBank. You will be introduced to the basic building blocks to develop simple, yet meaningful automation logic. We will also run this first test and review the result.
This Scenario will,
- Log in to the QBank application
- Verifies the existence of "Account Summary" link in the left-nav of the home page and
- Logs out the user
Here is the Scenario described in the video.
Let's log in to your ACCELQ Account and create the necessary entities for this test. Simply click on the "+" icon in the top-right corner and select the entity names as described below.
Contexts or Pages
We will be dealing with 2 pages (Contexts) in this Scenario. Let's create these as Contexts in ACCELQ. After filling in the names of the Contexts, click on the "Save" button in the modal.
- QB Login Page, which represents the login page of QBank
- QB Home Page, which represents the user's home page in QBank
Your test (Scenario) should include 3 Actions as follows. Let's create these. After providing the necessary information in the "New Action" modal, click on the "Save" button in the modal.
Here are the 3 Actions and the information necessary to populate:
- Login to QBank, which starts in the "QB Login Page" and takes the application to "QB Home Page" (destination)
- Verify Account Summary link, which is done in the "QB Home Page" (application will stay in the same Context after this step, Current Context)
- Logout from QBank, which starts in the "QB Home Page" and navigates the application back to "QB Login Page" (destination)
Create a Scenario with the name, “Verify QBank Login”. After typing the name of the Scenario in the modal, click on "Save and Continue".
QBank URL and credentials
Now follow the steps in the Scenario page and complete the Scenario to reflect the flow as defined in our objective. It should look somewhat like this when you are done.
Now, it is time to build test logic in the Actions (3) used as part of the Scenario. Click on each of the Actions in the Scenario steps, which will open a new tab with the Action page.
Let's look at an example for Login to QBank Action.
- Click the "Views" tab at the bottom of the Action screen.
- Click the "Capture New View" button that will initiate a process to record QB Login Page for us. Follow the steps in the plugin and complete the recording.
To accomplish the login on QBank, we need to enter the username, enter the password and click the sign-in button. This is achieved by writing statements to emulate these interactions on the screen.
- Right-click on the username field in the View that was just recorded, and select "Enter text in element". Follow the steps to add the statement.
- Similarly hover on the password field and sign-in buttons in the View and put appropriate statements.
Your logic should look somewhat like below:
Follow the same process for the other 2 Actions in the Scenario. When you are done writing the logic, make sure the Scenario page does not show any alerts in front of the step names.
Run the test
Once you have set up the logic in every Action, it is now time to run the test. In the Scenario page, click on the "Run" button. With default options in the Run modal, simply start the test execution.
Navigate to the Results page (from the "Results" left-nav in ACCELQ).
Your test execution report will look like this.
Behind the Scenes
We created our first working Automation scenario. And along the way, we have set up several reusable assets and a good base for a well-designed automation suite.
Let's understand these assets briefly. Click on “Navigator” in the left-nav in ACCELQ and review the entities. Feel free to open these and familiarize yourself with the layout.
Entities created in the project
- Contexts: We created 2 Contexts, representing 2 pages in our QBank application. In the future, we will be creating a lot of other Actions in these Contexts.
- Views captured and the elements saved in individual pages are properly grouped under these Contexts.
- "View" is what ACCELQ uses to learn more about the test application.
- Actions: We defined 3 Actions overall, belonging to 2 pages/Contexts. Actions are "using" the Views and elements from the "owner" Context. And these same Actions will be used in several Scenarios in the future.
- Scenario: A Scenario that has assembled the 3 Actions into a flow, and now can become part of your automation suite.
Rather than starting bottom-up, where you created the Contexts, Actions, and then the Scenario in sequence, you could take a more efficient top-down approach as well. You can simply start with the creation of the Scenario and then introduce Contexts and Actions as part of the Scenario step development.
Here is how you can do this.
If you feel the excitement, let's go ahead and try this out. You can simply delete all the assets that you just created and try out the top-down approach. You can delete entities in bulk from the Navigator grids. Ping us on the Q Community slack channel if you need help.