Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
erp5
Commits
13d43568
Commit
13d43568
authored
Nov 30, 2017
by
Roque Porchetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scalability_test: define scalability test suites for ERP5 project in /scalability_test
parent
07e3a446
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
0 deletions
+127
-0
scalability_test/__init__.py
scalability_test/__init__.py
+51
-0
scalability_test/example/createPerson.py
scalability_test/example/createPerson.py
+72
-0
scalability_test/example/scalabilityUsers.py
scalability_test/example/scalabilityUsers.py
+4
-0
No files found.
scalability_test/__init__.py
0 → 100644
View file @
13d43568
import
os.path
import
json
class
ERP5_scalability
():
def
getTestList
(
self
):
return
[
'createPerson'
]
def
getTestPath
(
self
):
return
'examples/'
def
getUsersFilePath
(
self
):
return
'examples/scalabilityUsers'
def
getUserQuantity
(
self
,
test_number
):
return
[
20
,
30
,
40
,
50
,
75
][
test_number
]
# Test duration in seconds
def
getTestDuration
(
self
,
test_number
):
return
40
*
self
.
getUserQuantity
(
test_number
)
def
getTestRepetition
(
self
,
test_number
):
return
3
def
getScalabilityTestUrl
(
self
,
instance_information_dict
):
erp5_address
=
instance_information_dict
[
"zope-address"
]
return
"http://%s/erp5"
%
erp5_address
def
getScalabilityTestMetricUrl
(
self
,
instance_information_dict
,
**
kw
):
metrics_url
=
"http://%s:%s@%s/erp5"
%
(
instance_information_dict
[
'user'
],
instance_information_dict
[
'password'
],
instance_information_dict
[
'zope-address'
])
return
metrics_url
+
"/ERP5Site_getScalabilityTestMetric"
def
getScalabilityTestOutput
(
self
,
metric_list
):
if
not
metric_list
:
return
None
output_json
=
json
.
loads
(
metric_list
[
0
])
for
metric
in
metric_list
:
metric_json
=
json
.
loads
(
metric
)
if
metric_json
[
"person_per_hour"
]
>
output_json
[
"person_per_hour"
]:
output_json
=
metric_json
return
"Person: %s doc/hour; SaleOrder: %s doc/hour;"
%
(
str
(
output_json
[
"person_per_hour"
]),
str
(
output_json
[
"sale_order_per_hour"
]))
def
getBootstrapScalabilityTestUrl
(
self
,
instance_information_dict
,
count
=
0
,
**
kw
):
bootstrap_url
=
"http://%s:%s@%s/erp5"
%
(
instance_information_dict
[
'user'
],
instance_information_dict
[
'password'
],
instance_information_dict
[
'zope-address'
])
bootstrap_url
+=
"/ERP5Site_bootstrapScalabilityTest"
bootstrap_url
+=
"?user_quantity=%i"
%
self
.
getUserQuantity
(
count
)
return
bootstrap_url
scalability_test/example/createPerson.py
0 → 100644
View file @
13d43568
# -*- coding: utf-8 -*-
TMIN_SLEEP_SHORT
=
2
TMAX_SLEEP_SHORT
=
6
TMIN_SLEEP
=
5
TMAX_SLEEP
=
15
TMIN_SLEEP_LONG
=
10
TMAX_SLEEP_LONG
=
30
def
createPerson
(
result
,
browser
):
"""
Create a Person and add a telephone number. It can be ran infinitely (e.g.
until it is interrupted by the end user) with 1 concurrent user, through
performance_tester_erp5 with the following command:
performance_tester_erp5 http://foo.bar:4242/erp5/ 1 createPerson
Please note that you must run this command from the same directory of this
script and userInfo.py. Further information about performance_tester_erp5
options and arguments are available by specifying ``--help''.
This test requires the bt5 erp5_simulation_performance_test to be installed
for relation with organisation.
Also, in order to get more realistic results with concurrent users, random
sleep must be introduced to simulate a "real" user. This can be done through
'sleep' parameter (a tuple giving the minimum and maximum sleep time) to
open*() (Browser instance), submit*() (Form instance) and click*() (Link
instance).
"""
# Open ERP5 homepage
browser
.
open
(
sleep
=
(
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
))
# Log in unless already logged in by a previous test suite
browser
.
mainForm
.
submitLogin
(
sleep
=
(
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
))
# Go to Persons module (person_module)
result
(
'Go to person module'
,
browser
.
mainForm
.
submitSelectModule
(
value
=
'/person_module'
,
#value='/erp5/person_module',
sleep
=
(
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)))
# Create a new person and record the time elapsed in seconds
result
(
'Add Person'
,
browser
.
mainForm
.
submitNew
())
# Check whether it has been successfully created
assert
browser
.
getTransitionMessage
()
==
'Object created.'
# Fill the first and last name of the newly created person
browser
.
mainForm
.
getControl
(
name
=
'field_my_first_name'
).
value
=
'Create'
browser
.
mainForm
.
getControl
(
name
=
'field_my_last_name'
).
value
=
'Person'
result
(
'Save'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
person_url
=
browser
.
url
# Go back to the Person page before validating
browser
.
open
(
person_url
)
# Validate it (as the workflow action may not be available yet, try 5 times
# and sleep 5s between each attempts before failing)
show_validate_time
,
waiting_for_validate_action
=
\
browser
.
mainForm
.
submitSelectWorkflow
(
value
=
'validate_action'
,
maximum_attempt_number
=
5
,
sleep_between_attempt
=
5
,
sleep
=
(
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
))
result
(
'Waiting for validate_action'
,
waiting_for_validate_action
)
result
(
'Show validate'
,
show_validate_time
)
result
(
'Validated'
,
browser
.
mainForm
.
submitDialogConfirm
())
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
\ No newline at end of file
scalability_test/example/scalabilityUsers.py
0 → 100644
View file @
13d43568
# Specify user login/password used to run the tests.
# <password> and <user_quantity> will be automatically replaced by testnode for each configuration
user_tuple
=
tuple
([(
'scalability_user_%i'
%
x
,
"<password>"
)
for
x
in
range
(
0
,
<
user_quantity
>
)])
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment