appianclient¶
-
class
appian_locust.appianclient.
AppianClient
(session: locust.clients.HttpSession, host: str, base_path_override: str = None, portals_mode: bool = False, config_path: str = './config.json')¶ Bases:
object
-
property
app_importer
¶ API for importing applications
See _app_importer
-
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
-
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.
-
declare_device_as_mobile
() → None¶ API for designating a device as mobile to spoof running on a mobile device.
-
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, config_path: str = './config.json') → 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
-
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.
-
tasks
= []¶
-
property
-
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