What is the objective?
It is a common requirement in automation to be able to parse information on the screen and use it for further validations in your logic, or messaging in the report. For example, consider a requirement such as capturing the transaction ID of a fund transfer operation.
In this challenge, we will build a Scenario to perform a fund transfer operation in QBank which generates a transaction ID as a confirmation. We will be automating this flow and capturing the transaction ID in our logic.
The Scenario will
- Log in to QBank
- Navigate to Fund Transfer Page
- Perform fund transfer with appropriate inputs
- Capture and print the Transaction ID as a confirmation of the transfer
Here is the Scenario described in the video:
<TBD: Video>
Automation Steps
Let’s log in to ACCELQ and create the necessary entities for this test. We are introducing some brand new entities (Contexts, Actions, and Scenario) in this example.
Contexts/Pages
We will need to create the following new pages:
- Funds Transfer Page
- Funds Transfer Confirmation Page
Actions
Here are the 4 new Actions in this flow. Create them by pressing the "+" icon in the top right corner of the ACCELQ screen. Do not write the logic in these Actions yet.
- Navigate To Funds Transfer Page: Navigates the application from the QBank Account Summary Page to the Funds Transfer Page.
- Perform Funds Transfer: Populate fields on the Funds Transfer Page, which navigates the application to Funds Transfer Confirmation Page.
- Verify transfer confirmation: Capture and print the transaction ID displayed on the Funds Transfer Confirmation Page.
- Navigate To Account Summary Page: Navigate to the Account Summary Page from the Funds Transfer Confirmation Page.
Scenario
Create a Scenario with the name “Verify Funds Transfer in QBank”. Click "Save and Continue".
Complete the Scenario to reflect the steps we need for the flow. It should look somewhat like this when you are done. You will notice the alert icon in front of the 3 newly created steps (Actions). We will build the test logic for these three Actions in the next step.
Test logic
Let us now build the test logic for the new Actions in this Scenario.
Navigate To Fund Transfer Page
Open the Action. Click the "Views" pane at the bottom and hover on the "Make a Transfer" button in the View. Right-click and choose the operation to click the element.
Perform Fund Transfer
Open the Action and click on the "Views" pane at the bottom. You will notice there are no Views, as this is a brand new page we introduced in this Scenario.
Follow the steps to capture this page's View. While you do this, you may also perform the actual fund transfer on QBank and capture View for the next page as well (Fund Transfer Confirmation Page).
To build the logic, right-click on the “Transfer from” field and select the appropriate dropdown command operation. For this Scenario, choose the “Select Item in Dropdown by Text” command.
Repeat this process for the following fields. You can leave the remaining fields as default.
- Transfer to: Select one of the dropdown items
- Amount: Be sure to not exceed 100 for the amount field
- Memo: You can simply type "test" in the memo
Verify transfer confirmation
Open the Action and click on the Views pane at the bottom. We will limit the logic in this Action simply to read the transaction ID and print. We will cover extensive verifications in subsequent challenges.
Right-click on the Transaction ID on the screen and start typing to find the command: “Get Element Text”, as we are trying to read this text.
Any time you are trying to "capture" information, you need to provide a placeholder parameter that will store this information. In ACCELQ, there are two different types of parameters you can use to capture information. Select "Action Output" and provide a name "Transaction ID" for this parameter.
After inserting this statement, type "print" in a new Action logic statement and select "Log Parameter Value" command.
Your logic should look like this:
Navigate to Account Summary Page
This Action will involve clicking on the "Go to Account Summary" button. Go ahead and write this one statement in the logic.
Run the Test
Run the test and navigate to the Results page (from the “Results” left-nav in ACCELQ). Your test execution report will look like this. You will notice that the transaction ID has been captured and printed.
Design Considerations
To Capture or to Ignore?
When you write a statement to read information from the screen, you have an option to either capture the output or simply ignore it. This could be decided based on the fact if the returned value has any use for subsequent validations.
If you wish to toggle between "capture" and "ignore", you can simply right-click on the statement in Action logic and change it later.
Action Output or Local Parameter?
When you are capturing information into a placeholder, you have an option to store this information either in a Local parameter or in an Action output. It is important to make the right choice keeping in view your specific use case.
Action Output is "visible" even outside the particular Action where this information is being captured. In the current example, Transaction ID will be visible in the Scenario step, which can be used for further validations. An Action may even "output" more than one parameter, depending on the need.
If the purpose of the captured information is only to serve internal logic development in the Action, you are better off choosing "Local Parameter". This avoids the unnecessary clutter exposed to Scenario and other steps in the flow. We will use Local Parameters in future challenges.
Comments
0 comments
Please sign in to leave a comment.