An Init Action is the one that can be used as a starting step in a Scenario. Recall that Scenario is a composition of Actions represented as Steps. When you are setting up a Scenario, each step follows the preceding step based on its applicability in the flow.
Init Actions allow you to create a starting point for a Scenario, without depending on the previous Step. Invoking the test application is typically what an Init Action does. If your end-to-end Scenario involves working with multiple applications, you may insert multiple Init steps in the flow.
System-defined Init Actions
An ACCELQ project comes pre-loaded with a set of Init Actions that can be used for general-purpose application invocations.
Initiate Browser Session
Invokes a browser with a given URL. Note that the Browser type and other details are automatically picked from the inputs you provide as part of the test execution (Run modal).
Launch Mobile Device
This Action establishes a connection with a real/emulated mobile device and launches the test app. You may invoke a local device, or a device on the cloud, based on the Agent selection during the test execution. The OS type and device are determined by the settings during the test execution (Run modal).
Open Terminal Emulator Session
Opens a Terminal Emulator session, so that subsequent steps in the Scenario may interact with the mainframe emulator screen.
Defining custom Init Actions
In addition to the system-provided Init Actions, you may define your own custom Init Actions if you need customized logic to initialize the application screen. For example, you may have a requirement to custom build the URL before you open the browser, applying some business logic. You can compose this logic in any regular Action and just mark it as Init Action.
You can configure an Action as an "Init" Action as follows:
- On the Action entity page, click on the Info icon on the top right to open up Action Information.
- Scroll down to the APPLICABILITY Section and hover over the text below the sub-text that reads “This action is configured for".
- Click on Change to open up the Change Applicability modal.
- Under the modal that opens up Change Applicability to Init Action from the dropdown list.
- Click on UPDATE.
Most commonly, Init Actions are general purpose and used across different applications. So, you could mark the Destination Context as "unspecified". Refer to this article for help on setting the Destination context.
Commands to initialize various application types
If you are building custom init Actions, in addition to the business logic, you need to include a statement to initialize necessary drivers and invoke the application in your logic. Here are the commands you can use:
- Browser: Invoke Browser
- Mobile app: Initialize Mobile Device Connection
- Terminal emulator: Open Terminal Emulator Session
Multiple Init Steps in a Scenario
Note that a Scenario may include multiple Init steps if the flow requires so. Typically when you are building an end-to-end test case going across multiple applications, you will need to insert Init steps for each of the applications at appropriate points in the flow.