Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
telecom
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Roque
telecom
Commits
362974ac
Commit
362974ac
authored
Nov 28, 2017
by
Roque Porchetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scalability_test: new methods in test suite and new test createSaleOrder
parent
496f3b95
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
4 deletions
+148
-4
scalability_test/__init__.py
scalability_test/__init__.py
+21
-4
scalability_test/examples/createSaleOrder.py
scalability_test/examples/createSaleOrder.py
+127
-0
No files found.
scalability_test/__init__.py
View file @
362974ac
...
...
@@ -3,7 +3,7 @@ import os.path
class
WendelinERP5_scalability
():
def
getTestList
(
self
):
return
[
'createPerson'
]
return
[
'createPerson'
,
'createSaleOrder'
]
def
getTestPath
(
self
):
return
'examples/'
...
...
@@ -11,13 +11,30 @@ class WendelinERP5_scalability():
def
getUsersFilePath
(
self
):
return
'examples/scalabilityUsers'
def
getUser
Number
(
self
,
test_number
):
return
[
45
,
135
,
170
,
220
,
250
][
test_number
]
def
getUser
Quantity
(
self
,
test_number
):
return
[
20
,
30
,
40
,
50
,
75
][
test_number
]
# Test duration in seconds
def
getTestDuration
(
self
,
test_number
):
return
60
*
10
return
40
*
self
.
getUserQuantity
(
test_number
)
def
getTestRepetition
(
self
,
test_number
):
return
3
def
getScalabilityTestUrl
(
self
,
instance_information
):
erp5_address
=
instance_information
[
"zope-address"
]
return
"http://%s/erp5"
%
erp5_address
def
getScalabilityTestUser
(
self
,
instance_information
):
return
instance_information
[
"user"
]
def
getScalabilityTestPassword
(
self
,
instance_information
):
return
instance_information
[
"password"
]
def
getBootstrapScalabilityTestUrl
(
self
,
count
=
0
,
instance_information_dict
=
None
,
**
kw
):
bootstrap_url
=
"http://%s:%s@%s/erp5"
%
(
instance_information
[
'user'
],
instance_information
[
'password'
],
instance_information
[
'zope-address'
])
bootstrap_url
+=
"/ERP5Site_bootstrapScalabilityTest"
boostrap_url
+=
"?user_quantity=%i"
%
self
.
getUserQuantity
(
count
)
return
boostrap_url
scalability_test/examples/createSaleOrder.py
0 → 100644
View file @
362974ac
# -*- coding: utf-8 -*-
import
datetime
import
random
import
time
import
string
from
utils
import
*
TMIN_SLEEP
=
2
TMAX_SLEEP
=
6
SALE_TRADE_CONDITION_NAME
=
"Scalability Sale Trade Condition"
PREFIX_TITLE
=
""
MAX_PRODUCT
=
5
def
addOrderLine
(
browser
,
my_title
,
result
)
:
"""
Add an order line to the sale order
@param browser: Browser
@type browser: Browser
@param my_title: The sale order title
@type my_title: string
"""
# Create a new Sale Order Line
browser
.
mainForm
.
submitSelectAction
(
label
=
"Add Sale Order Line"
)
assert
browser
.
getTransitionMessage
()
==
'Object created.'
# Fill the quantity randomly
browser
.
mainForm
.
getControl
(
name
=
'field_my_quantity'
).
value
=
str
(
random
.
randint
(
1
,
20
))
result
(
'SetRelationProduct'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
## Choose the product randomly
fillRelatedObjects
(
browser
,
result
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
1
,
"AddOrderLine"
,
TMIN_SLEEP
,
TMAX_SLEEP
)
def
createSaleOrder
(
result
,
browser
):
"""
Create a Sale Order with details using Sale Trade Condition to fill,
and add some random sale order lines.
Use the following command:
performance_tester_erp5 http://foo.bar:4242/erp5/ 1 createSaleOrder
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 it requires a configured Sale Trade Condition.
"""
# Open ERP5 homepage and log in
result
(
'Open'
,
browser
.
open
())
# Log in unless already logged in by a previous test suite
result
(
'Login'
,
browser
.
mainForm
.
submitLogin
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Go to sale Order module
result
(
'GotoModule'
,
browser
.
mainForm
.
submitSelectModule
(
value
=
'/sale_order_module'
,
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Create a new sale order and record the time elapsed in seconds
result
(
'Create'
,
browser
.
mainForm
.
submitNew
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether it has been successfully created
assert
browser
.
getTransitionMessage
()
==
'Object created.'
my_order_sale_url
=
browser
.
url
.
split
(
"?"
)[
0
]
# Fill the title
my_title
=
PREFIX_TITLE
+
generateString
(
6
)
browser
.
mainForm
.
getControl
(
name
=
'field_my_title'
).
value
=
my_title
# Set some random informations
my_str
=
generateString
(
random
.
randint
(
1
,
100
))
browser
.
mainForm
.
getControl
(
name
=
'field_my_comment'
).
value
=
my_str
browser
.
mainForm
.
getControl
(
name
=
'field_my_description'
).
value
=
my_str
# Select some options randomly
selectRandomOption
(
browser
,
"field_my_order"
)
# Set dates
date
=
datetime
.
datetime
.
now
()
browser
.
mainForm
.
getControl
(
name
=
'subfield_field_my_start_date_day'
).
value
=
str
(
date
.
day
)
browser
.
mainForm
.
getControl
(
name
=
'subfield_field_my_start_date_month'
).
value
=
str
(
date
.
month
)
browser
.
mainForm
.
getControl
(
name
=
'subfield_field_my_start_date_year'
).
value
=
str
(
date
.
year
)
# Submit the changes, record the time elapsed in seconds
result
(
'Save'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
sale_order_url
=
browser
.
url
## Set Sale Trade conditions
# Click on the specified menu
result
(
'GoToSaleTradeConditionRelations'
,
browser
.
mainForm
.
getControl
(
name
=
"portal_selections/viewSearchRelatedDocumentDialog2:method"
).
click
())
assert
browser
.
getTransitionMessage
()
==
'Please select one object.'
line_number
=
browser
.
getListboxPosition
(
SALE_TRADE_CONDITION_NAME
,
column_number
=
2
)
# Check the box corresponding to line_number
browser
.
mainForm
.
getListboxControl
(
line_number
=
line_number
,
column_number
=
1
).
click
()
result
(
'SubmitSaleTradeConditionRelation'
,
browser
.
mainForm
.
submit
(
name
=
'Base_callDialogMethod:method'
,
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Add Sale order lines
max_ite
=
random
.
randint
(
1
,
MAX_PRODUCT
)
for
i
in
range
(
0
,
max_ite
):
browser
.
open
(
sale_order_url
+
"/view"
)
addOrderLine
(
browser
,
my_title
,
result
)
browser
.
open
(
my_order_sale_url
)
# Validate the Sale Order
browser
.
mainForm
.
submitSelectWorkflow
(
value
=
'plan_action'
)
result
(
'Validate'
,
browser
.
mainForm
.
submitDialogConfirm
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
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