What is the objective?
We will write a Scenario to verify user profile information in the QBank application.
This Scenario will
- Log in to the QBank application
- Navigates to the Profile page
- Verifies name, email address, and the phone number
- Exits out of the profile page
- 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.
If you think about it, this Scenario is going through similar steps and pages as the previous exercise. All assets we created in the previous challenge are readily reusable. Hence we will only be creating the entities that are newly introduced.
Contexts or Pages
We have come across one new page as part of this exercise. Let's create this as a new Context in ACCELQ. After filling in the name of the Contexts, click on the "Save" button in the modal.
- QB Profile Page, which represents the Profile page of QBank
Your test (Scenario) includes 5 steps as described in the objective. Out of these, login and logout are already available as Actions. We will be building 3 new Actions to represent the 3 additional steps. 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:
- Navigate to Profile page, which starts in the "QB Home Page" and takes the application to "QB Profile Page" (destination)
- Verify Profile info, which is done in the "QB Profile Page" (application will stay in the same Context after this step, Current Context)
- Exit from Profile Page, which starts in the "QB Profile Page" and navigates the application back to "QB Home Page" (destination)
Create a Scenario with the name, “Verify Profile Information”. 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. You notice the alert icon in front of the two newly created steps (Actions). We will build test logic for these 2 Actions in the next section.
Now, it is time to build test logic for the 2 newly created Actions used as part of the Scenario. Click on each of the Actions with an alert icon in the Scenario steps, which will open a new tab with the Action page.
Let's look at an example for Verify Profile Info Action.
- Click the "Views" tab at the bottom of the Action screen.
- Since this is a brand new page we are introducing in our project, let's capture the necessary View.
- Click the "Capture New View" button and start recording. When working with the plugin, be sure to navigate to the relevant page in the application before pressing the "Record" button.
Now, once you get the View, right-click on various elements in the View and select appropriate commands. Simply type "verify" or "validate" in the command search as below and choose appropriate commands.
Your logic should look somewhat like below:
Follow the same process for the last Action (Exit Profile page), which simply clicks on the "Cancel" button on the page. 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 have now further beefed up our test assets by introducing a new Context and 2 new Actions. This incremental process will continue and we start to see the "Universe" growing with every test case.
Entities are reused
In this Scenario, 2 out of 4 steps (excluding the system-provided browser invocation step) were already existing and we simply reused them. Adding new Scenarios will quickly gain momentum and at some point, it may just be a matter of assembling existing steps (Actions) and creating the flow.
Feel free to click on “Navigator” in the left-nav in ACCELQ and review the entities. You may also click "Universe" in the left nav and understand how various entities are related.
Anatomy of a text verification command
In ACCELQ, you can bring up verification-related command suggestions by simply typing something appropriate such as "verify", "validate", "check" etc.
When you are verifying information on the screen, the following generic observations can be made.
- Indicate the target element you are verifying.
- The expected value that you want to verify against.
- Specifying the nature of verification which includes case-sensitive, contains vs. equal, etc.
- Specifying the failure-action, which indicates what to do in case of a failure. You can choose to just give an error and proceed with the test or to completely abort the test case. You would choose the latter option if the verification is not only significant but when further steps in the test may be irrelevant in case of this failure.
Once again, rather than creating the new Contexts and Actions starting bottom-up, you could create necessary Actions and Contexts as part of the Scenario creation itself. Going forward, we will be taking this top-down approach for all the new examples. Feel free to practice this approach and play around. Ping us on the Q Community slack channel if you need help.