appianclient

class appian_locust.appianclient.AppianClient(session: locust.clients.HttpSession, host: str, base_path_override: str = None, portals_mode: bool = False)

Bases: object

property actions

API for querying, starting and completing actions

See _actions

property admin

API for interacting with the Admin Console

See _actions

property app_importer

API for importing applications

See _app_importer

property design

API for interacting with /design

See _actions

get_client_feature_toggles() → None
property interactor

Interactor that can be used to make lower level requests against Appian

See _interactor

login(auth: list = None, check_login: bool = True) → Tuple[locust.clients.HttpSession, requests.models.Response]
logout() → None

Logout from Appian

property news

API for interacting with the news feed

See _news

property records

API for interacting with record lists and record dashboards

See _records

property reports

API for importing applications

See _reports

property sites

API for interacting with sites in Appian

See _sites

property tasks

API for interacting with tasks and task forms in Appian

See _tasks

class appian_locust.appianclient.AppianTaskSequence(parent: locust.user.sequential_taskset.SequentialTaskSet)

Bases: locust.user.sequential_taskset.SequentialTaskSet, appian_locust.appianclient.AppianTaskSet

tasks = []
class appian_locust.appianclient.AppianTaskSet(parent: locust.user.task.TaskSet)

Bases: locust.user.task.TaskSet

property appian

A wrapper around the generated AppianClient

declare_device_as_desktop() → None

API for designating a device as desktop to emulate running on a computer device. This is done by default, so only use this method when running a mix of mobile and desktop tests.

See declare_device_as_mobile

declare_device_as_mobile() → None

API for designating a device as mobile to spoof running on a mobile device.

See declare_device_as_mobile

determine_auth() → List[str]

Determines what Appian username/password will be used on simulated logins. Auth will be determined using the following rules:

If only “auth” key exists in config file, use the corresponding username and password for every login

If only “credentials” key exists, pop one pair of credentials per Locust user until there’s only one pair left. Then use the last pair of credentials for all remaining logins

If both of the above keys exist, first use up all pairs in the “credentials” key, then use the pair in “auth” repeatedly for all remaining logings.

In distributed mode, if only “credentials” key exists, each load driver will use last pair of credentials in the subset assigned to it via the setup_distributed_creds method.

For example, if there are 3 pairs of credentials and 5 users per driver:

Load driver 1 user 1 will take credential pair 1 Load driver 2 users 1-5 will take credential pair 2 Load driver 1 user 2-5 (and all after) will take credential pair 3

Parameters

None

Returns

2-entry list formatted as follows: [“username”, “password”]

Return type

auth

on_start(portals_mode: 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

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[appian_locust._feature_flag.FeatureFlag]) → None

API for overriding default feature flags.

See override_default_flags

tasks = []
class appian_locust.appianclient.NoOpEvents

Bases: object

context(*args: str, **kwargs: int) → dict
fire(*args: str, **kwargs: int) → None
appian_locust.appianclient._trim_trailing_slash(host: str) → str
appian_locust.appianclient.appian_client_without_locust(host: str, record_mode: bool = False, base_path_override: str = None)appian_locust.appianclient.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 :returns: an Appian client that can be used :rtype: AppianClient

appian_locust.appianclient.procedurally_generate_credentials(CONFIG: dict) → None

Helper method that can be used to procedurally generate a set of Appian user credentials

Note: This class must be called in the UserActor class of your Locust test in order to create the credentials before any Locust users begin to pick them up.

Parameters
  • CONFIG – full locust config dictionary, AKA the utls.c variable in locust tests Make sure the following keys are present.

  • procedural_credentials_prefix – Base string for each generated username

  • procedural_credentials_count – Appended to prefix, will create 1 -> Count+1 users

  • procedural_credentials_password – String which will serve as the password for all users

Returns

None

appian_locust.appianclient.setup_distributed_creds(CONFIG: dict) → dict

Helper method to distribute Appian credentials across separate load drivers when running Locust in distributed mode. Credential pairs will be passed out in Round Robin fashion to each load driver.

Note: This class must be called in the UserActor class of your Locust test to ensure that the “credentials” key is prepared before tests begin.

Note: If fewer credential pairs are provided than workers, credentials will be distributed to workers in a Modulo fashion.

Parameters

CONFIG – full locust config dictionary, AKA the utls.c variable in locust tests Make sure the following keys are present.

Returns

same as input but with credentials key updated to just the subset of credentials required for given load driver.

Return type

CONFIG