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. 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.
Library Actions are typically best suited for non-UI test functions such as API, Database, Message Queue, etc. where you achieve modularity, but at the same time, the Action does not impose any contextual restrictions.
Example for Library Action
Consider the following Action,
Verify account balance in Database
This Action fetches balance for various accounts from the backend database and verifies as expected. It may be called in a Scenario flow right after the Login, before the balance transfer, after the balance transfer, or anywhere else. It is said to have no contextual relevance.
Marking an Action as Library Action
You can mark an Action as Library Action either during the creation of an Action or later by editing the Action Applicability.
- When creating an Action, click on the text/link that reads ”Init/Library Action?”
- From the resulting menu under “Type of Action” choose the radio button – “Library Action”.
Destination Context is not applicable when you are marking an Action as Library Action, and hence the dropdown will be disabled.
You may also change an Action to Library Action after it is created.
- 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 Library Action from the dropdown list.
- Click on UPDATE.
When a non-library Action is converted to a Library Action, its Destination context changes (and becomes n/a). If you have a Scenario using this Action, then the steps following the current Action may be impacted if there is a missing-step sequence. Learn more about missing steps.
Inserting Library Action in Scenario
When adding a step in a Scenario, all Library Actions are displayed in the Relevant tab all the time. You can pick a Library Action to insert at any step in the flow.