Note
By contributing to this Open Source project, you provide Appian Corporation a non-exclusive, perpetual, royalty-free license to use your contribution for any purpose.
Contributing
Fork the appian-locust repository
Make any desired changes
Commit changes and push to your fork
Make a merge request to the upstream fork and project maintainers will review it
New Development
As new development is done to Appian Locust, the core principle of user navigation and resulting interaction should be kept in mind.
Is your feature adding interaction capabilities to an existing type of page? If so, you likely want to add a new method to an
existing SailUiForm
type. Otherwise, you might need to create a new extention of SailUiForm
and ensure that the Visitor
class has the capabilities to visit the new page type. Lastly, functionality that doesn’t involve user interaction should be included in the
SiteHelper
class.
If you think that your development falls outside of the above criteria, you should submit an issue for the maintainers of this project to discuss your use case.
To Test Your Changes
In any test-implementation repo where you use appian-locust, change the following (assuming you’re using a Pipfile
)
appian-locust = {path="../appian-locust", editable=true}
NOTE The path above assumes appian-locust is checked out locally, hence we can use a relative directory path.
And run pipenv install --skip-lock
to allow you to use a local version of appian-locust
without recreating the lock file. However, remember to use a lock file in your test-implementation repo.
Now you can test your changes as you normally would.
Internal Classes
Apart from our exposed API, we provide internal classes for more granular control when developing or testing.
- appian_locust._locust_error_handler._format_http_error(resp: Response, uri: str, username: str) str
- Taken from Response.raise_for_status. Formats the http error message,
additionally adding the username
- Parameters:
resp (Response) – Response to generate an http error message from
uri (str) – URI accessed as part of the request
username (str) – Username of the calling user
- Returns:
the http error message to use
- Return type:
str
- appian_locust._locust_error_handler.test_response_for_error(resp: ResponseContextManager, uri: str = 'No URI Specified', raise_error: bool = True, username: str = '', name: str = '') None
Locust relies on errors to be logged to the global_stats attribute for error handling. This function is used to notify Locust that its instances are failing and that it should fail too.
- Parameters:
resp (Response) – a python response object from a client.get() or client.post() call in Locust tests.
uri (Str) – URI in the request that caused the above response.
username (Str) – identifies the current user when we use multiple different users for locust test)
- Returns:
None
Example (Returns a HTTP 500 error):
username = 'admin' uri = 'https://httpbin.org/status/500' with self.client.get(uri) as resp: test_response_for_error(resp, uri, username)
- class appian_locust._save_request_builder._SaveRequestBuilder
Bases:
object
Builds a save request, that can be used to trigger saves on the UI
- build() Dict[str, Any]
- component(component: Dict[str, Any]) _SaveRequestBuilder
- context(context: Dict[str, Any]) _SaveRequestBuilder
- identifier(identifier: Dict[str, Any] | None) _SaveRequestBuilder
- uuid(uuid: str) _SaveRequestBuilder
- value(value: dict | list) _SaveRequestBuilder
- appian_locust._save_request_builder.save_builder() _SaveRequestBuilder