Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
50851399
Commit
50851399
authored
8 years ago
by
Mateus Rambo Strey
Browse files
Options
Downloads
Patches
Plain Diff
add some tests to locustfile
parent
5dd4db90
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
locustfile.py
+30
-4
30 additions, 4 deletions
locustfile.py
with
30 additions
and
4 deletions
locustfile.py
+
30
−
4
View file @
50851399
# locust --host=http://localhost:3000
from
locust
import
HttpLocust
,
TaskSet
from
random
import
randrange
,
sample
# def login(l):
# l.client.post("/login", {"username":"ellen_key", "password":"education"})
def
index
(
l
):
def
users
(
l
):
l
.
client
.
get
(
"
/v1/users
"
)
def
profile
(
l
):
def
learning_object
(
l
):
l
.
client
.
get
(
"
/v1/learning_objects/
"
+
str
(
randrange
(
1
,
18000
)),
name
=
"
/v1/learning_objects/:id
"
)
def
learning_objects
(
l
):
l
.
client
.
get
(
"
/v1/learning_objects
"
)
def
search
(
l
):
words
=
[
'
dna
'
,
'
teste
'
,
'
arvore
'
,
'
amazonia
'
,
'
portugues
'
,
'
computador
'
,
'
ciencia
'
]
l
.
client
.
get
(
"
/v1/search?query=
"
+
sample
(
words
,
1
)[
0
]
+
"
&search_class=LearningObject
"
,
name
=
"
/v1/search?search_class=LearningObject
"
)
def
licenses
(
l
):
l
.
client
.
get
(
"
/v1/licenses
"
)
def
mime_types
(
l
):
l
.
client
.
get
(
"
/v1/mime_types
"
)
def
object_types
(
l
):
l
.
client
.
get
(
"
/v1/object_types
"
)
def
roles
(
l
):
l
.
client
.
get
(
"
/v1/roles
"
)
def
subjects
(
l
):
l
.
client
.
get
(
"
/v1/subjects
"
)
def
educational_stages
(
l
):
l
.
client
.
get
(
"
/v1/educational_stages
"
)
class
UserBehavior
(
TaskSet
):
tasks
=
{
index
:
2
,
profile
:
1
}
tasks
=
{
learning_object
:
5
,
learning_objects
:
2
,
users
:
1
,
search
:
5
,
licenses
:
1
,
mime_types
:
1
,
object_types
:
1
,
roles
:
1
,
subjects
:
1
,
educational_stages
:
1
}
# def on_start(self):
# login(self)
...
...
@@ -19,4 +45,4 @@ class UserBehavior(TaskSet):
class
WebsiteUser
(
HttpLocust
):
task_set
=
UserBehavior
min_wait
=
5000
max_wait
=
9
000
max_wait
=
15
000
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment