DescartesResearch / TeaStore

A micro-service reference test application for model extraction, cloud management, energy efficiency, power prediction, single- and multi-tier auto-scaling
https://se.informatik.uni-wuerzburg.de
Apache License 2.0
118 stars 137 forks source link

Locust file #179

Closed Angi2412 closed 3 years ago

Angi2412 commented 3 years ago

Hello,

I want to use the application in my thesis and don't have experience with JMeter or the other load generating tool. So, I wondered if there is a converted version for locust.io available? Or would it be possible to describe the structure of the implemented user behaviour (with URLs)?

Thanks!

SimonEismann commented 3 years ago

I think @jo102tz used locust with the Teastore, maybe he can dig up his scripts.

The browse load profile traverses the following URLs:

  1. GET http://TeaStoreIP/ Loads the landing page
  2. GET http://TeaStoreIP/login Visits the login page
  3. POST http://TeaStoreIP/loginAction?username=user1&password=password Login request, with a random user number in the range [1-90]
  4. GET http://TeaStoreIP/category?page=1&category=ID visit random category page (category IDs can be extracted from the previously returned html)
  5. GET http://TeaStoreIP/product?id=ID visit random product page (product ID can be extracted from the previously returned html)
  6. POST http://TeaStoreIP/cartAction?addToCart=&productid=ID add random product to the cart (same ID as previous request)
  7. GET http://TeaStoreIP/category?page=1&category=ID visit random category page (category IDs can be extracted from the previously returned html)
  8. GET http://TeaStoreIP/category?page=X&category=ID visit random page for previous category (page numbers can be extracted from the previously returned html)
  9. POST http://TeaStoreIP/cartAction?addToCart=&productid=ID add another random product to the cart (same ID as previous request)
  10. GET http://TeaStoreIP/profile Look at user profile
  11. POST http://TeaStoreIP/loginAction?logout= Logout again

The buy profile extends this behavior by executing http://TeaStoreIP/cartAction?firstname=User&lastname=User&address1=Road&address2=City&cardtype=volvo&cardnumber=314159265359&expirydate=12/2050&confirm=Confirm between steps 10/11.

I hope this helps, let me know if you have any further questions.

In case you end up reimplementing this behavior in locust, feel free to open up a pull request that adds it to the examples folder.

Angi2412 commented 3 years ago

Thank you very much for your fast response. This was very helpful. I reimplemented the behaviour with minor differences: the category, product and page ids are chosen randomly as well as the number of possible products in the cart based on settings from the database (for now this has to be entered manually). Is there an API request to get this information?

I will test the implementation further and then open a pull request :)

jo102tz commented 3 years ago

Unfortunately, I can not find our locust script anymore. However, feel free to share it, if yours runs well. :)

SimonEismann commented 3 years ago

Minor update to previous URLs, I think they are all missing a /tools.descartes.teastore.webui/ such as:

http://TeaStoreIP/tools.descartes.teastore.webui/profile

For the number of products/categories, you could get that from the persistence API. I think the URL looks something like this: http://PersistenceIP/tools.descartes.teastore.persistence/rest/categories http://PersistenceIP/tools.descartes.teastore.persistence/rest/products http://PersistenceIP/tools.descartes.teastore.persistence/rest/users

However, I can't test right now if these URLs are correct, you can find the underlying implementation here: https://github.com/DescartesResearch/TeaStore/tree/master/services/tools.descartes.teastore.persistence/src/main/java/tools/descartes/teastore/persistence/rest

Angi2412 commented 3 years ago

Thank you 👍