Stress test tool with statistical TPS reports based on Worker Dispatcher in Python
Project description
Python Stress Tool
Stress test tool with statistical TPS reports based on Worker Dispatcher in Python
Features
-
Based on Worker Dispatcher to managed workers
-
Statistical TPS Report in Excel sheets
-
Customized Config for the report
OUTLINE
DEMONSTRATION
Just write your own callback functions based on the Worker Dispatcher library, then run it and generate the report file:
import stress_test
def each_task(id: int, config, task, log):
response = requests.get(config['my_endpoint'] + task)
return response
def main():
results = stress_test.start({
'task': {
'list': ['ORD_AH001', 'ORD_KL502', '...' , 'ORD_GR393'],
'callback': each_task,
'config': {
'my_endpoint': 'https://your.name/order-handler/'
},
}
})
if results != False:
file_path = stress_test.generate_report(file_path='./tps-report.xlsx')
print("Report has been successfully generated at {}".format(file_path))
if __name__ == '__main__':
main()
INTRODUCTION
This tool generates professional TPS report based on the execution result from the Worker Dispatcher library.
Dependencies:
- worker-dispatcher
- openpyxl
INSTALLATION
To install the current release:
$ pip install stress-tool
Import it in your Pythone code:
import stress_test
USAGE
By calling the start()
method with the configuration parameters, the package will invoke Worker Dispatcher to dispatch tasks, managing threading or processing based on the provided settings. Once the tasks are completed, generate_report()
can be called to produce a TPS report based on the result of Worker Dispatcher.
generate_report()
An example configuration setting with all options is as follows:
def generate_report(config: dict={}, worker_dispatcher: object=None, file_path: str='./tps-report.xlsx'):
config
Option | Type | Deafult | Description |
---|---|---|---|
raw_logs.fields | dict | None | Customized field setting for the Raw Logs sheet. Key is field name, the value can be two types: - String: Grab from the key name of the log from Worker Dispacther. - lambda function: |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file stress_tool-1.0.1.tar.gz
.
File metadata
- Download URL: stress_tool-1.0.1.tar.gz
- Upload date:
- Size: 207.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25a8bf739d3022d154c641751d7eb97cd90dcaf6ee15afebcfdd5404b9758237 |
|
MD5 | 6e4e5d405806b8db1276261590904390 |
|
BLAKE2b-256 | d87058e9cd022a6411b602cc7c93d01acc0790a042447a7ad7bc0ea9039eb0e7 |
File details
Details for the file stress_tool-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: stress_tool-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7761250f29baae5db072cbe295b43f03f5cf585548ca35dc22137e7bf05a8a20 |
|
MD5 | 63fba13223c04768f28808f689d266f2 |
|
BLAKE2b-256 | 8b96758b4c3a8bf2884a4a59f0bd7863d26223db5ed894e728e0f351dcd07720 |