API
- class appian_locust.appian_client.AppianClient(session: HttpSession, host: str, base_path_override: str | None = None, portals_mode: bool = False, config_path: str = './config.json', is_mobile_client: bool = False)
Bases:
object
- property actions_info: ActionsInfo
Navigate to actions and gather information about available actions
- get_client_feature_toggles() None
- login(auth: list | None = None, check_login: bool = True) Tuple[HttpSession, Response]
- logout() None
Logout from Appian
- property records_info: RecordsInfo
Navigate to records and gather information about available records
- property reports_info: ReportsInfo
Navigate to reports and gather information about available reports
- property system_operator: SystemOperator
Abstraction used for system operation that do not require a UI
- appian_locust.appian_client.appian_client_without_locust(host: str, record_mode: bool = False, base_path_override: str | None = None) AppianClient
Returns an AppianClient that can be used without locust to make requests against a host, e.g.
>>> appian_client_without_locust() >>> client.login(auth=('username', 'password')) >>> client.get_client_feature_toggles()
This can be used for debugging/ making CLI style requests, instead of load testing You MUST call client.get_client_feature_toggles() to correctly finish initializing the client.
- Returns:
an Appian client that can be used
- Return type:
- class appian_locust.appian_task_set.AppianTaskSequence(parent: SequentialTaskSet)
Bases:
SequentialTaskSet
,AppianTaskSet
Appian Locust SequentialTaskSet. Provides functionality of Locust’s SequentialTaskSet and Handles creation of basic objects like``self.appian`` and actions like
login
andlogout
- tasks: List[TaskSet | Callable] = []
Collection of python callables and/or TaskSet classes that the User(s) will run.
If tasks is a list, the task to be performed will be picked randomly.
If tasks is a (callable,int) list of two-tuples, or a {callable:int} dict, the task to be performed will be picked randomly, but each task will be weighted according to its corresponding int value. So in the following case, ThreadPage will be fifteen times more likely to be picked than write_post:
class ForumPage(TaskSet): tasks = {ThreadPage:15, write_post:1}
- class appian_locust.appian_task_set.AppianTaskSet(parent: TaskSet)
Bases:
TaskSet
- property appian: AppianClient
A wrapper around the generated AppianClient
- on_start(portals_mode: bool = False, config_path: str = './config.json', is_mobile_client: bool = False) None
Overloaded function of Locust’s default on_start.
It will create object self.appian and logs in to Appian
- Parameters:
portals_mode (bool) – set to True if connecting to portals site
config_path (str) – path to configuration file
is_mobile_client (bool) – set to True if client should act as mobile
- on_stop() None
Overloaded function of Locust’s default on_stop.
It logs out the client from Appian.
- override_default_flags(flags_to_override: List[FeatureFlag]) None
override_default_flags gets the flag mask to set all of the flags to true given a list of flag enums and overrides the current feature flag extended value to set these flags to true.
- tasks: List[TaskSet | Callable] = []
Collection of python callables and/or TaskSet classes that the User(s) will run.
If tasks is a list, the task to be performed will be picked randomly.
If tasks is a (callable,int) list of two-tuples, or a {callable:int} dict, the task to be performed will be picked randomly, but each task will be weighted according to its corresponding int value. So in the following case, ThreadPage will be fifteen times more likely to be picked than write_post:
class ForumPage(TaskSet): tasks = {ThreadPage:15, write_post:1}
- class appian_locust.feature_flag.FeatureFlag(value)
Bases:
Enum
An enumeration.
- ALL_FEATURES = 1
- ALWAYS_ADD_RECORD_TYPE_INFORMATION = 45
- BILLBOARD_LAYOUT = 35
- BODY_URI_TEMPLATES = 14
- BOX_LAYOUT = 20
- CARD_LAYOUT = 39
- CERTIFIED_SAIL_EXTENSION = 47
- COMPACT_URI_TEMPLATES = 10
- DATA_EXPORT = 23
- DOCUMENT_VIEWER_LAYOUT = 44
- EVOLVED_BILLBOARD_LAYOUT = 50
- EVOLVED_GRIDFIELD = 52
- FILTERS_LAYOUT = 48
- FLUSH_RECORD_HEADERS = 57
- GAUGE_FIELD = 55
- GRID_ROW_SELECTION = 40
- ICON_WIDGET = 31
- IMAGES_INTERFACES_2 = 27
- IMAGE_CROPPING = 21
- IMPLICIT_SYSTYPE_NAMESPACE = 5
- INLINE_TASK_CONTROLS = 12
- IN_APP_BROWSER_AUTH = 59
- JUSTIFIED_LABEL_POSITION = 22
- LESS_OPAQUE_BILLBOARD_OVERLAYS = 58
- MEDIUM_LARGE_RICH_TEXT = 19
- MODERN_RECORD_TYPES_LIST = 38
- MULTIPLE_SAVE_USER_FILTERS = 60
- MULTI_SELECT_RECORD_FILTERS = 17
- NESTED_COLUMNS = 16
- NEWS_ENTRY_LAYOUT = 43
- NEWS_SUBSCRIPTION_SETTINGS = 46
- NEW_COLUMN_WIDTHS = 53
- NEW_RICH_TEXT_SIZES = 54
- NO_FEATURES = 0
- OFFLINE = 6
- PARTIAL_RENDERING = 7
- POSITIVE_NEGATIVE_RICH_TEXT = 18
- REACT_CLIENT = 11
- RECORD_ACTION_COMPONENT = 61
- RECORD_CHROME = 34
- RECORD_LIST_ACTION_LINK = 49
- RECORD_LIST_FEED_ITEM_DTO = 36
- RECORD_NEWS = 4
- RECORD_NEWS_FIELD = 37
- RELATIVE_URI_TEMPLATES = 13
- REPORT_LINK = 26
- REST_REDIRECT = 9
- RICH_TEXT_ACCENT_STYLE = 32
- SAIL_FORMS = 2
- SHORT_CIRCUIT_PARTIAL_RENDERING = 8
- SIDE_BY_SIDE_LAYOUT = 28
- SITE_RECORD_NEWS = 24
- START_PROCESS_LINK = 25
- SUBMISSION_LOCATION = 51
- TAG_FIELD = 56
- TASK_FORM_LAYOUT = 33
- TASK_PREVIEW = 3
- TWO_PART_RECORD_TAG_URI = 15
- USE_CLIENT_LOCALE = 41
- USE_MULTIPART_RECORD_UIS = 42
- WCC_READ_ONLY = 29
- WCC_READ_WRITE = 30
- class appian_locust.system_operator.SystemOperator(interactor: _Interactor, actions: _Actions)
Bases:
object
Class for providing the ability to perform activities that do not require a UI interaction i.e. triggering an action without a startform.
- fetch_autosuggestions(payload: Dict[str, Any], locust_request_label: str | None = None) Response
Retrieve suggestions from autosuggest endpoint :param payload: payload containing expression details to retrieve suggestions for :param locust_request_label: the label to be displayed by locust
Returns: Json response of suggestions
- fetch_content(opaque_id: str, locust_request_label: str | None) Response
Fetch a content element, such as an image :param opaque_id: The opaque id of the content to download :param locust_request_label: label to associate request with
Returns: Response object containing information of downloaded content
- get_webapi(uri: str, headers: Dict[str, Any] | None = None, locust_request_label: str | None = None, query_parameters: Dict[str, Any] = {}) Response
Make a GET request to a web api endpoint :param uri: API URI to be called :param headers: header for the REST API Call :param locust_request_label: the label to be displayed by locust :param query_parameters: Queries/Filters
Returns: Json response of GET operation
To set custom headers
>>> headers = {'Is-Admin': 'true'} ... self.appian.system_operator.get_webapi('/suite/webapi/headers', headers=headers)
To set custom query parameters
>>> params = {'age': 5, 'start-date': '10-05-2020'} ... self.appian.system_operator.get_webapi('/suite/webapi/query', query_parameters=params)
- post_webapi(uri: str, headers: Dict[str, Any] | None = None, locust_request_label: str | None = None) Response
Make a GET request to a web api endpoint :param uri: API URI to be called :param headers: header for the REST API Call :param locust_request_label: the label to be displayed by locust
Returns: Json response of GET operation
To set custom headers
>>> headers = {'Is-Admin': 'true'} ... self.appian.system_operator.post_webapi('/suite/webapi/headers', headers=headers)
- start_action(action_name: str, skip_design_call: bool = False, exact_match: bool = False) Response
Perform the post operation on action’s API to start specific action. Actions that do not have a UI can be called directly without using “GET” to retrieve the UI. this is controlled by the optional skip_design_call parameter
- Parameters:
action_name (str) – Name of the action
skip_design_call (bool, optional) – to skip the “GET” call for the action’s UI. Default : False
exact_match (bool, optional) – Should action name match exactly or to be partial match. Default : False
Returns: requests.models.Response
Example
>>> self.appian.site_helper.start_action("action_name")
- class appian_locust.visitor.Visitor(interactor: _Interactor, tasks: _Tasks, reports: _Reports, actions: _Actions, records: _Records, sites: _Sites)
Bases:
object
Provides methods to get an interactable
SailUiForm
from an Appian instance. Each method will return the respectedSailUiForm
type for which it will allow interactions with the visited page.- visit_action(action_name: str, exact_match: bool = False, locust_request_label: str | None = None) SailUiForm
Gets the action by name and returns the corresponding SailUiForm to interact with
If the action is activity chained, this will attempt to start the process and retrieve the chained SAIL form.
- Parameters:
action_name (str) – Name of the action to be called. Name of the action will be in the below pattern. “displayLabel::opaquqId”
exact_match (bool, optional) – Should action name match exactly or to be partial match. Default : False
locust_request_label (str, optional) – label to be used within locust. Default: ‘’ (empty string)
Returns: SailUiForm
Examples
If the full name of the action is known, with the opaque ID,
>>> self.appian.visitor.visit_action("action_name:igB0K7YxC0UQ2Fhx4hicRw...", exact_match=True)
If only the display name is known, or part of the display name
>>> self.appian.visitor.visit_action("action_name") >>> self.appian.visitor.visit_action("actio")
- visit_admin(locust_request_label: str | None = None) SailUiForm
Navigates to /admin :param locust_request_label: label to be used within locust :type locust_request_label: str, optional
Returns: SailUiForm
- visit_ai_skill_by_id(opaque_id: str, locust_request_label: str | None = None) AISkillUiForm
Visit an AI Skill by its opaque id :param opaque_id: opaque id of the AI Skill :type opaque_id: str :param locust_request_label: label to be used within locust :type locust_request_label: str, optional
Returns (AISkillUiForm): UiForm representing AI Skill
- visit_ai_skill_by_name(ai_skill_name: str, locust_request_label: str | None = None) AISkillUiForm
Visit an AI Skill by its name :param ai_skill_name: The name of the AI Skill :type ai_skill_name: str :param locust_request_label: label to be used within locust :type locust_request_label: str, optional
Returns (AISkillUiForm): UiForm representing AI Skill
- visit_application_by_id(application_id: str, locust_request_label: str | None = None) ApplicationUiForm
Visit an application by its opaque id
- Parameters:
application_id (str) – The opaque id of the application
locust_request_label (str, optional) – label to be used within locust
Returns (ApplicationUiForm): UiForm representing design application page
- visit_application_by_name(application_name: str, application_prefix: str | None = None, locust_request_label: str | None = None) ApplicationUiForm
Visit an application by name
- Parameters:
application_name (str) – The name of the application
application_prefix (str, optional) – The prefix of the application. Required if the application has a prefix.
locust_request_label (str, optional) – label to be used within locust
Returns (ApplicationUiForm): UiForm representing design application page
- visit_data_fabric(locust_request_label: str | None = None) SailUiForm
Navigate to Data Fabric :param locust_request_label: label to be used within locust :type locust_request_label: str, optional
Returns (SailUiForm): UiForm representing Data Fabric
- visit_data_fabric_dashboard(encoded_uri_stub: str = 'new', locust_request_label: str | None = None) SailUiForm
Navigate to a Data Fabric Dashboard :param encoded_uri_stub: encoded uri stub of the dashboard to load. Defaults to “new” if not provided, :type encoded_uri_stub: str :param bringing the user to an empty dashboard.: :param locust_request_label: label to be used within locust :type locust_request_label: str, optional
Returns (SailUiForm): UiForm representing a Data Fabric Dashboard
- visit_design(locust_request_label: str | None = None) DesignUiForm
Navigate to /design :param locust_request_label: label to be used within locust :type locust_request_label: str, optional
Returns (DesignUiForm): UiForm representing /design
- visit_design_object_by_id(opaque_id: str, locust_request_label: str | None = None) DesignObjectUiForm
Visit a design object by its opaque id :param opaque_id: opaque id of the design object :type opaque_id: str :param locust_request_label: label to be used within locust :type locust_request_label: str, optional
Returns (DesignObjectUiForm): UiForm representing design object
- visit_design_object_by_name(object_name: str, object_type: DesignObjectType, locust_request_label: str | None = None) DesignObjectUiForm
Visit a design object by its name and type :param object_name: The name of the design object :type object_name: str :param object_type: The type of the design object :type object_type: DesignObjectType :param locust_request_label: label to be used within locust :type locust_request_label: str, optional
Returns (DesignObjectUiForm): UiForm representing design object
- visit_portal_page(portal_unique_identifier: str, portal_page_unique_identifier: str, locust_request_label: str | None = None) SailUiForm
Navigate to portal’s page by url and returns the corresponding SailUiForm to interact with
- Parameters:
portal_unique_identifier (str) – portal web address unique identifier
portal_page_unique_identifier (str) – web address unique identifier for specific page in portal
locust_request_label (str, optional) – label to be used within locust
Returns: SailUiForm
Examples
If we have portal up and running with 2 pages with title “page1” and “page2”, we can visit any portal page with help of this method.
In order to visit “page1” with url (in browser: https://mysite.appian-internal.com/performance-testing/page/page1), we would use
>>> self.appian.visitor.visit_portal_page("performance-testing", "page1")
In order to visit “page2” with url (in browser: https://mysite.appian-internal.com/performance-testing/page/page2), we would use
>>> self.appian.visitor.visit_portal_page("performance-testing", "page2")
Note: sometimes when portal has just 1 page (for example page with title ‘page1’). appian use only “https://mysite.appian-internal.com/performance-testing” (in browser) instead of https://mysite.appian-internal.com/performance-testing/page/page1 . although it still works.
- visit_record_instance(record_type: str = '', record_name: str = '', view_url_stub: str = '', exact_match: bool = False, summary_view: bool = True, locust_request_label: str | None = None) RecordInstanceUiForm
Navigate to a specific record and return a RecordUiForm
- Parameters:
record_type (str) – Record Type Name. If not specified, a random record type will be selected.
record_name (str) – Name of the record to be called. If not specified, a random record will be selected.
view_url_stub (str, optional) – page/tab to be visited in the record. If not specified, “summary” dashboard will be selected.
exact_match (bool, optional) – Should record type and record name matched exactly as it is or partial match.
summary_view (bool, optional) – Should the Record UI be returned in Summary View, if false will return Header View
locust_request_label (str, optional) – Label locust should associate this request with
Returns (RecordUiForm): The UI for the record instance
- visit_record_type(record_type: str = '', locust_request_label: str | None = None) RecordListUiForm
This function calls the API for the specific record type and returns a SAIL form representing the list of records for that record type.
- Parameters:
record_type (str) – Record Type Name. If not specified, a random record type will be selected.
locust_request_label (str, optional) – Label locust should associate this request with
Returns (SailUiForm): UI representing list of records for that record type
- visit_report(report_name: str, exact_match: bool = True, locust_request_label: str | None = None) SailUiForm
Navigate to a report and return a SailUiForm for that report’s UI
- Parameters:
report_name (str) – Name of the report to be called.
exact_match (bool, optional) – Should report name match exactly or to be partial match. Default : True
locust_request_label (str, optional) – Label locust should associate this request with
Returns (SailUiForm): Response of report’s Get UI call in SailUiForm
- visit_site(site_name: str, page_name: str, locust_request_label: str | None = None) SailUiForm
Get a SailUiForm for a Task, Report or Action
- Parameters:
site_name (str) – Site where the page exists
page_name (str) – Page to navigate to
locust_request_label (str, optional) – Label locust should associate this request with
Returns: SailUiForm
Example
>>> self.appian.visitor.visit_site("site_name","page_name")
- visit_site_recordlist(site_name: str, page_name: str, locust_request_label: str | None = None) RecordListUiForm
Get a RecordListUiForm for a record list page on a site
- Parameters:
site_name (str) – Site where the page exists
page_name (str) – Page to navigate to
locust_request_label (str, optional) – label to be used within locust
- NOTE: The actual Type of the Site Page MUST be “Record List”, this will not work for sites that are of other page types,
such as an Interface with a record grid.
Returns: SailUiForm
Example
>>> self.appian.visitor.visit_site_recordlist("site_name","page_name")
- visit_site_recordlist_and_get_random_record_form(site_name: str, page_name: str, locust_request_label: str | None = None) RecordInstanceUiForm
Navigates to a site page that is a recordlist then clicks on a random record instance on the first page
- Parameters:
site_name – Site Url stub
page_name – Page Url stub
locust_request_label (str, optional) – label to be used within locust
- NOTE: The actual Type of the Site Page MUST be “Record List”, this will not work for sites that are of other page types,
such as an Interface with a record grid.
Returns: RecordInstanceUiForm
- visit_task(task_name: str, exact_match: bool = True, locust_request_label: str | None = None) SailUiForm
Gets the SailUiForm given a task name
- Parameters:
task_name (str) – Name of the task to search for
exact_match (bool, optional) – Whether or not a full match is returned. Defaults to True.
locust_request_label (str, optional) – label to be used within locust
- Returns:
SAIL form for the task
- Return type: