Skip to content

Commit

Permalink
Add few more web related locust tasks
Browse files Browse the repository at this point in the history
task frequency comes from curated plausible.io stats
  • Loading branch information
atodorov committed Jan 23, 2025
1 parent 6236678 commit f608ad7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
36 changes: 33 additions & 3 deletions tests/performance/web_simulation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,50 @@
# https://www.gnu.org/licenses/agpl-3.0.html

from base import BrowserTestCase
from locust import task
from locust import between, task
from locust_plugins.users.playwright import event, pw

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'event' is not used.


class UserActionsTestCase(BrowserTestCase):
"""
Visit the most commonly visited pages in Kiwi TCMS according to
curated plausible.io stats. Try to behave like a human with generous
waiting time between the different pages b/c people don't click at
lightning fast speed like robots.
"""

log_external = False
log_tasks = False
wait_time = between(10, 60)

@task(21)
@pw
async def visit_plans_search_page(self, page):
await self.setup_page(page)

@task
await page.goto("/plan/search/")
await page.wait_for_load_state()

@task(33)
@pw
async def visit_runs_search_page(self, page):
await self.setup_page(page)

await page.goto("/runs/search/")
await page.wait_for_load_state()

@task(38)
@pw
async def visit_cases_search_page(self, page):
await self.setup_page(page)

await page.goto("/cases/search/")
await page.wait_for_load_state()

# note: raise StopUser() doesn't work here
@task(100)
@pw
async def visit_dashboard_page(self, page):
await self.setup_page(page)

await page.goto("/")
await page.wait_for_load_state()
2 changes: 1 addition & 1 deletion tests/test_http.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ _EOF_
# this is designed to check that these files don't crash,
rlRun -t -c "locust --headless --users 1 --spawn-rate 1 --run-time 5s -H https://localhost/ --locustfile tests/performance/base.py"
rlRun -t -c "locust --headless --users 1 --spawn-rate 1 --run-time 5s -H https://localhost/ --locustfile tests/performance/api_write_test.py"
rlRun -t -c "locust --headless --users 1 --spawn-rate 1 --run-time 5s -H https://localhost/ --locustfile tests/performance/web_simulation_test.py"
rlRun -t -c "locust --headless --users 1 --spawn-rate 0.01 --run-time 5s -H https://localhost/ --locustfile tests/performance/web_simulation_test.py"
rlPhaseEnd

rlPhaseStartCleanup
Expand Down

0 comments on commit f608ad7

Please sign in to comment.