What is an Action?
An Action is a meaningful test function defined in a Context. For example, when you are in the QBank Login Page (Context), you may have possible Actions such as:
- Login to QBank
- Initiate forgot password
- Verify footer links etc.
Actions need not just be limited to UI-based interactions or verifications. For example, you may have an Action in Account Summary Page, Get current balance from the database, which just retrieves the current balance for an account from the database. You may also have an Action that just invokes a Rest API and verifies the response.
Action is defined in a Context
An Action is defined as part of a Context. For eample, QBank Login Page, Account Summary Page, etc. are considered “Owner” or “Origin” Contexts for respective Actions. An Action utilizes resources available from its owner Context.
Multiple Actions may be defined in a given Context and all such Actions share the resources such as Views, Elements, etc available in the Context.
What does an Action contain?
Action contains the “logic” or “statements” to achieve the test function. For example,
- Login to QBank Action will have statements to enter the user name, enter the password and click on the sign-in button.
- Initiate forgot password Action may have a statement to click on the “Forgot Password” link.
- Verify footer links Action may have multiple statements to verify the footer links in the QBank Login Page.
Statements may include UI interactions, UI verifications, non-UI commands such as connecting to a database, reading an email, or other logic control statements. Logic forms the crux of an Action.
When an Action is performed which includes statements for UI interaction, the application state may change. Destination Context of an Action indicates which page/Context the application will be in, after the completion of this Action.
For example, Login to QBank may lead the application to the Account Summary Page.
There are multiple options available for specifying the “Destination Context” of an Action. You will learn more about destination contexts in a detailed topic.
In the case of non-UI Actions, Destination Context may be ignored by marking the Action as "Library Action".
Action is used in a Scenario
A Scenario, which represents the use case you are testing on your application is formed by combining a series of Actions. An Action becomes a “Step” in a Scenario.
- An Action is “modular” in nature and “reusable” by definition.
- A Scenario is made up of series of Actions and a given Action can be used in multiple Scenarios.
Example 1: Login to QBank
Qbank Login Page > Account Summary Page
Includes logic to enter the user name, password, and click on login button.
Example 2: Provide transfer Info
Transfer Info Page > Confirmation Page
Includes logic to fill all the fields and clicking on the "submit" button.
Example 3: Initiate Funds Transfer
Account Summary Page > Transfer Info Page
Action logic includes just clicking on the link.
Example 4: Verify funds transfer
Confirmation Page > Confirmation Page
Logic includes verifying the transaction amount and that the confirmation number is of the right format.
Example 5: View Wish list
Amazon Home Page > Wish list Page
Logic includes clicking on the "Lists" link and selecting "View my lists"