Package: aiotest
What is Aiotest?Aiotest is an easy to use, scriptable and scalable performance testing tool.You define the behaviour of your users in Python asyncio code, instead of being stuck in a UI or restrictive domain specific language.This makes Aiotest infinitely expandable and very developer friendly.To start using Aiotest, go toInstallationInstall the packagepip install aiotestRun aiotestaiotest -f aiotestfile.pyfromaiotestimportAsyncHttpUser,LoadUserShape,loggerclassTestUser(AsyncHttpUser):host="https://uat.taobao.com"token=Noneasyncdefon_start(self):url="/login"data={"username":"admin","password":"123456"}asyncwithself.session.post(url=url,data=data)asresp:data=awaitresp.json()self.token=data["token"]asyncdeftest_search(self):url="/search"hearders={"Authorization":self.token}data={"keyword":"F22"}asyncwithself.session.post(url=url,hearders=hearders,json=data)asresp:data=awaitresp.json()asyncdeftest_personal_info(self):url="/personalInfo"asyncwithself.session.get(url=url,hearders=hearders)asresp:data=awaitresp.json()FeaturesWrite test scenarios inpython asyncioIf you want your users to loop, perform some conditional behaviour or do some calculations, you just use the asyncio programming constructs provided by Python.
Aiotest runs every user inside its task (a asyncio task). This enables you to write your tests like normal (async) Python code instead of having to use callbacks or some other mechanism.
Because your scenarios are "just python" you can use your regular IDE, and version control your tests as regular codeDistributed and scalable - supports hundreds of thousands of concurrent usersAiotest makes it easy to run load tests distributed over multiple machines.
It is asyncio-based (usingpython asyncio, which makes it possible for a single process to handle many thousands concurrent users.
While there may be other tools that are capable of doing more requests per second on a given hardware, the low overhead of each Aiotest user makes it very suitable for testing highly concurrent workloads.Command-based UIIt can also be run without the UI, making it easy to use for CI/CD testing.Can test any systemEven though Aiotest primarily works with web sites/services, it can be used to test almost any system or protocol. Justwrite a client for what you want to testPrometheus-Grafana-based Data collection and presentationUse Prometheus to collect test data and Grafana to present itAutomatic collection of test cases(Reference pytest)An automatic collection of use cases similar to pytest, subclasses of User and LoadUserShape must start or end with Test(eg: TestUser,TestShape...), and api coroutines to be tested must also start or end with test(eg: test_search, test_personal_info...)Multiple user classes, flexible setting of test scenariosA aiotestfile can have multiple user classes at the same time, set different execution weights through the user class attribute weight, and flexibly set various test scenarios, example, shopping mall ordering scene, a user class simulating direct placing an order, and a user class simulating shopping cart placing an order.Custom load shapesSometimes a completely custom shaped load test is required that cannot be achieved by simply setting or changing the user count and spawn rate. For example, you might want to generate a load spike or ramp up and down at custom times. By using a LoadUserShape class you have full control over the user count and spawn rate at all times.Serial, parallel execution of api coroutinesEach user (a user class instance) acquiesce executes the test api coroutine serial from top to bottom(eg: when placing an order in the mall, the rear interface must wait for the return data from the front interface before it can be executed);You can override the self.start() method of the user class to execute the api coroutine to be tested in parallel(eg: api do not need to wait for the return data of other apis, and can be executed in parallel)AuthorsHewei githubmail:hewei1987@163.comLicenseOpen source licensed under the MIT license (see LICENSE file for details).Express one's thanksAiotest is a rewrite of locust (based on python asyncio) that drops the TaskSet class, sets the API to be tested only through the User class, drops the Stats class, collects test data through Prometheus, drops the Web class, and presents test data through Grafanalocust.io