An Action is a reusable block of logic that achieves a meaningful test function. Consider the following examples:
- You may have an Action "Login to QBank" which interacts with your web application and automatically performs Login on the page.
- You may have an Action "Get current balance from DB", that connects to a database and executes a query to return the Account balance of a user.
Applicability of an Action
- Where in a Scenario flow, can a given Action be used as a step?
- What Actions can follow as steps in a Scenario, after a given Action?
- Which Actions can call a given Action?
Collectively these restrictions define what is called contextual relevance or applicability of an Action.
Configuring the Applicability of an Action
In ACCELQ, you configure the Applicability of an Action when creating the Action. Subsequently, you can manage this from the "Information" sidebar of the Action.
Applicability is defined by the following attributes.
Origin Context of an Action is the Context (page) where the Action is possible to run in the application. For example, the Origin Context for “Login to QBank” is “QB SignIn Page”. You specify the Origin Context when creating an Action.
Some Actions may be applicable from multiple Origin Contexts. For example, “Logout from QBank” may be possible from multiple Contexts (pages) in the application, as the same functionality is available from multiple pages. You can add to the list of Origin Contexts from the "Information" sidebar of the Action.
Note: Owner Context is the Context in which an Action is stored. Action logic makes use of elements available in the Owner Context. The Origin Context specified when creating an Action becomes its Owner Context also. You may change the Owner Context later if required.
Destination Context is the name of the Context (page) where the application will land after executing an Action. For example, “Logout from QBank” leads to the Destination Context “QB SignIn Page”. You specify the Destination Context when creating an Action.
Some Actions may not change the state of the application. For example: "Verify account balance" is performed in the Account Summary Page (Origin Context), and does not alter the state of the application. In such cases, you can refer to the Destination Context as "Curr Context".
Some Actions may have more than one Destination Context. For example, an Action "Confirm Purchase" in an application may lead either to the "Purchase Confirmation Page" or to the "Verify Credit Card Info" page depending on business rules. For this Action, you can indicate both these pages as possible Destination Contexts.
Origin & Destination Contexts in a Scenario
When you build a Scenario, once you add a step (an Action), you may only add subsequent steps (Actions) whose "Origin Context" matches the "Destination Context" of the step that is just added before this step. When you are building a Scenario in ACCELQ, step suggestions are based on this analysis of the Actions available in your Project.
When an Action is marked as Init Action, you may use it as a starting step (first step) in a Scenario. In other words, Init Action does not have a specific Origin Context. You can mark an Action as Init Action while creating an Action, and can be changed subsequently from the Information sidebar.
Logic in Init Action typically includes invoking the browser or the application. Learn more about Init Actions.
Library Action is a general-purpose Action that has no contextual relevance. It can be used anywhere in a Scenario and any Action can call this Action.
You can mark an Action as a Library Action when creating the Action, and can be changed later from the Information sidebar.
Not only that you can insert a Library Action anywhere in a Scenario, but it also has no effect on what steps can follow it.
A Library Action cannot include statements to interact with UI (web, mobile, TE, desktop, etc.) and cannot reference any UI Elements.
Here is an article with a detailed description of Library Action.
Visible for Scenario
This flag determines if an Action is available while building a Scenario. If this flag is turned off, this Action cannot be used in a Scenario. You typically turn off Scenario access to those Actions which are meant to be used only in other Actions to achieve modularity in logic design. Here is a detailed article about this flag.
Calling Actions from other Actions
An Action may either be used in a Scenario or called from another Action.
An Action may be called from another Action only when the Origin & Destination Contexts of the "called" and "caller" Actions have a match. The following rules apply:
- The Destination Context of the called Action must either match with the Destination Context of the "caller" Action or it should be “Current Context”.
- The Origin of the "called" Action must be part of the Origin Context of the "caller" Action.
More about calling Actions here.