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
Laurent S
erp5
Commits
5c4c85e3
Commit
5c4c85e3
authored
Sep 20, 2013
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5-util-benchmark: cleanup useless spaces
parent
35c854b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
39 deletions
+39
-39
erp5/util/benchmark/examples/createSaleOrder.py
erp5/util/benchmark/examples/createSaleOrder.py
+18
-18
erp5/util/benchmark/examples/createWebPage.py
erp5/util/benchmark/examples/createWebPage.py
+9
-9
erp5/util/benchmark/examples/utils.py
erp5/util/benchmark/examples/utils.py
+12
-12
No files found.
erp5/util/benchmark/examples/createSaleOrder.py
View file @
5c4c85e3
...
@@ -17,7 +17,7 @@ MAX_PRODUCT = 5
...
@@ -17,7 +17,7 @@ MAX_PRODUCT = 5
def
addOrderLine
(
browser
,
my_title
,
result
)
:
def
addOrderLine
(
browser
,
my_title
,
result
)
:
"""
"""
Add an order line to the sale order
Add an order line to the sale order
@param browser: Browser
@param browser: Browser
@type browser: Browser
@type browser: Browser
@param my_title: The sale order title
@param my_title: The sale order title
...
@@ -26,12 +26,12 @@ def addOrderLine(browser, my_title, result) :
...
@@ -26,12 +26,12 @@ def addOrderLine(browser, my_title, result) :
# Create a new Sale Order Line
# Create a new Sale Order Line
browser
.
mainForm
.
submitSelectAction
(
label
=
"Add Sale Order Line"
)
browser
.
mainForm
.
submitSelectAction
(
label
=
"Add Sale Order Line"
)
assert
browser
.
getTransitionMessage
()
==
'Object created.'
assert
browser
.
getTransitionMessage
()
==
'Object created.'
# Fill the quantity randomly
# Fill the quantity randomly
browser
.
mainForm
.
getControl
(
name
=
'field_my_quantity'
).
value
=
str
(
random
.
randint
(
1
,
20
))
browser
.
mainForm
.
getControl
(
name
=
'field_my_quantity'
).
value
=
str
(
random
.
randint
(
1
,
20
))
result
(
'SetRelationProduct'
,
browser
.
mainForm
.
submitSave
(
result
(
'SetRelationProduct'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
## Choose the product randomly
## Choose the product randomly
fillRelatedObjects
(
browser
,
result
,
fillRelatedObjects
(
browser
,
result
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
1
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
1
,
...
@@ -54,20 +54,20 @@ def createSaleOrder(result, browser):
...
@@ -54,20 +54,20 @@ def createSaleOrder(result, browser):
"""
"""
# Open ERP5 homepage and log in
# Open ERP5 homepage and log in
result
(
'Open'
,
browser
.
open
())
result
(
'Open'
,
browser
.
open
())
# Log in unless already logged in by a previous test suite
# Log in unless already logged in by a previous test suite
result
(
'Login'
,
browser
.
mainForm
.
submitLogin
(
result
(
'Login'
,
browser
.
mainForm
.
submitLogin
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Go to sale Order module
# Go to sale Order module
result
(
'GotoModule'
,
result
(
'GotoModule'
,
browser
.
mainForm
.
submitSelectModule
(
value
=
'/sale_order_module'
,
browser
.
mainForm
.
submitSelectModule
(
value
=
'/sale_order_module'
,
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Create a new sale order and record the time elapsed in seconds
# Create a new sale order and record the time elapsed in seconds
result
(
'Create'
,
result
(
'Create'
,
browser
.
mainForm
.
submitNew
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
browser
.
mainForm
.
submitNew
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether it has been successfully created
# Check whether it has been successfully created
assert
browser
.
getTransitionMessage
()
==
'Object created.'
assert
browser
.
getTransitionMessage
()
==
'Object created.'
my_order_sale_url
=
browser
.
url
.
split
(
"?"
)[
0
]
my_order_sale_url
=
browser
.
url
.
split
(
"?"
)[
0
]
...
@@ -75,15 +75,15 @@ def createSaleOrder(result, browser):
...
@@ -75,15 +75,15 @@ def createSaleOrder(result, browser):
# Fill the title
# Fill the title
my_title
=
PREFIX_TITLE
+
generateString
(
6
)
my_title
=
PREFIX_TITLE
+
generateString
(
6
)
browser
.
mainForm
.
getControl
(
name
=
'field_my_title'
).
value
=
my_title
browser
.
mainForm
.
getControl
(
name
=
'field_my_title'
).
value
=
my_title
# Set some random informations
# Set some random informations
my_str
=
generateString
(
random
.
randint
(
1
,
100
))
my_str
=
generateString
(
random
.
randint
(
1
,
100
))
browser
.
mainForm
.
getControl
(
name
=
'field_my_comment'
).
value
=
my_str
browser
.
mainForm
.
getControl
(
name
=
'field_my_comment'
).
value
=
my_str
browser
.
mainForm
.
getControl
(
name
=
'field_my_description'
).
value
=
my_str
browser
.
mainForm
.
getControl
(
name
=
'field_my_description'
).
value
=
my_str
# Select some options randomly
# Select some options randomly
selectRandomOption
(
browser
,
"field_my_order"
)
selectRandomOption
(
browser
,
"field_my_order"
)
# Set dates
# Set dates
date
=
datetime
.
datetime
.
now
()
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_day'
).
value
=
str
(
date
.
day
)
...
@@ -92,7 +92,7 @@ def createSaleOrder(result, browser):
...
@@ -92,7 +92,7 @@ def createSaleOrder(result, browser):
# Submit the changes, record the time elapsed in seconds
# Submit the changes, record the time elapsed in seconds
result
(
'Save'
,
result
(
'Save'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether the changes have been successfully updated
# Check whether the changes have been successfully updated
...
@@ -104,24 +104,24 @@ def createSaleOrder(result, browser):
...
@@ -104,24 +104,24 @@ def createSaleOrder(result, browser):
# Click on the specified menu
# Click on the specified menu
result
(
'GoToSaleTradeConditionRelations'
,
browser
.
mainForm
.
getControl
(
result
(
'GoToSaleTradeConditionRelations'
,
browser
.
mainForm
.
getControl
(
name
=
"portal_selections/viewSearchRelatedDocumentDialog2:method"
).
click
())
name
=
"portal_selections/viewSearchRelatedDocumentDialog2:method"
).
click
())
assert
browser
.
getTransitionMessage
()
==
'Please select one object.'
assert
browser
.
getTransitionMessage
()
==
'Please select one object.'
line_number
=
browser
.
getListboxPosition
(
SALE_TRADE_CONDITION_NAME
,
column_number
=
2
)
line_number
=
browser
.
getListboxPosition
(
SALE_TRADE_CONDITION_NAME
,
column_number
=
2
)
# Check the box corresponding to line_number
# Check the box corresponding to line_number
browser
.
mainForm
.
getListboxControl
(
line_number
=
line_number
,
column_number
=
1
).
click
()
browser
.
mainForm
.
getListboxControl
(
line_number
=
line_number
,
column_number
=
1
).
click
()
result
(
'SubmitSaleTradeConditionRelation'
,
result
(
'SubmitSaleTradeConditionRelation'
,
browser
.
mainForm
.
submit
(
name
=
'Base_callDialogMethod:method'
,
browser
.
mainForm
.
submit
(
name
=
'Base_callDialogMethod:method'
,
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Add Sale order lines
# Add Sale order lines
max_ite
=
random
.
randint
(
1
,
MAX_PRODUCT
)
max_ite
=
random
.
randint
(
1
,
MAX_PRODUCT
)
for
i
in
range
(
0
,
max_ite
):
for
i
in
range
(
0
,
max_ite
):
browser
.
open
(
sale_order_url
+
"/view"
)
browser
.
open
(
sale_order_url
+
"/view"
)
addOrderLine
(
browser
,
my_title
,
result
)
addOrderLine
(
browser
,
my_title
,
result
)
browser
.
open
(
my_order_sale_url
)
browser
.
open
(
my_order_sale_url
)
# Validate the Sale Order
# Validate the Sale Order
browser
.
mainForm
.
submitSelectWorkflow
(
value
=
'plan_action'
)
browser
.
mainForm
.
submitSelectWorkflow
(
value
=
'plan_action'
)
result
(
'Validate'
,
result
(
'Validate'
,
browser
.
mainForm
.
submitDialogConfirm
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
browser
.
mainForm
.
submitDialogConfirm
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
erp5/util/benchmark/examples/createWebPage.py
View file @
5c4c85e3
...
@@ -26,7 +26,7 @@ def createWebPage(result, browser):
...
@@ -26,7 +26,7 @@ def createWebPage(result, browser):
"""
"""
# Open ERP5 homepage
# Open ERP5 homepage
browser
.
open
(
sleep
=
(
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
))
browser
.
open
(
sleep
=
(
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
))
# Log in unless already logged in by a previous test suite
# Log in unless already logged in by a previous test suite
browser
.
mainForm
.
submitLogin
(
sleep
=
(
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
))
browser
.
mainForm
.
submitLogin
(
sleep
=
(
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
))
...
@@ -58,25 +58,25 @@ def createWebPage(result, browser):
...
@@ -58,25 +58,25 @@ def createWebPage(result, browser):
selectRandomOption
(
browser
,
"subfield_field_my_site_list_default:list"
)
selectRandomOption
(
browser
,
"subfield_field_my_site_list_default:list"
)
selectRandomOption
(
browser
,
"subfield_field_my_function_list_default:list"
)
selectRandomOption
(
browser
,
"subfield_field_my_function_list_default:list"
)
browser
.
mainForm
.
getControl
(
name
=
'field_my_subject_list'
).
value
=
generateString
(
30
)
browser
.
mainForm
.
getControl
(
name
=
'field_my_subject_list'
).
value
=
generateString
(
30
)
## Fill the Follow-up input
## Fill the Follow-up input
fillRelatedObjects
(
browser
,
result
,
fillRelatedObjects
(
browser
,
result
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
NUMMAX_FOLLOW_UP
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
NUMMAX_FOLLOW_UP
,
"FollowUp"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
"FollowUp"
,
TMIN_SLEEP_SHORT
,
TMAX_SLEEP_SHORT
)
# Submit the changes, record the time elapsed in seconds
# Submit the changes, record the time elapsed in seconds
result
(
'Save'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
result
(
'Save'
,
browser
.
mainForm
.
submitSave
(
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether the changes have been successfully updated
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
web_page_url
=
browser
.
url
web_page_url
=
browser
.
url
## Edit the relations with other existing documents
## Edit the relations with other existing documents
# Go to the Related Documents view
# Go to the Related Documents view
browser
.
open
(
web_page_url
+
"/Document_viewRelated"
)
browser
.
open
(
web_page_url
+
"/Document_viewRelated"
)
# Fill the Referenced Documents input
# Fill the Referenced Documents input
fillRelatedObjects
(
browser
,
result
,
fillRelatedObjects
(
browser
,
result
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
3
,
"portal_selections/viewSearchRelatedDocumentDialog0:method"
,
3
,
...
@@ -102,6 +102,6 @@ def createWebPage(result, browser):
...
@@ -102,6 +102,6 @@ def createWebPage(result, browser):
result
(
'Waiting for publish_action'
,
waiting_for_publish_action
)
result
(
'Waiting for publish_action'
,
waiting_for_publish_action
)
result
(
'Show publish'
,
show_publish_time
)
result
(
'Show publish'
,
show_publish_time
)
result
(
'Published'
,
browser
.
mainForm
.
submitDialogConfirm
())
result
(
'Published'
,
browser
.
mainForm
.
submitDialogConfirm
())
# Check whether the changes have been successfully updated
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
erp5/util/benchmark/examples/utils.py
View file @
5c4c85e3
...
@@ -4,7 +4,7 @@ import string
...
@@ -4,7 +4,7 @@ import string
def
selectRandomOption
(
browser
,
select_name
):
def
selectRandomOption
(
browser
,
select_name
):
"""
"""
Function to select randomly an option
Function to select randomly an option
@param browser: Browser
@param browser: Browser
@type browser: Browser
@type browser: Browser
@param select_name: Name of the input
@param select_name: Name of the input
...
@@ -20,7 +20,7 @@ def selectRandomOption(browser, select_name):
...
@@ -20,7 +20,7 @@ def selectRandomOption(browser, select_name):
def
generateString
(
size
)
:
def
generateString
(
size
)
:
"""
"""
Function to generate a string randomly (a-z)
Function to generate a string randomly (a-z)
@param size: Size of the string
@param size: Size of the string
@type size: int
@type size: int
"""
"""
...
@@ -32,7 +32,7 @@ def generateString(size) :
...
@@ -32,7 +32,7 @@ def generateString(size) :
def
fillRelatedObjects
(
browser
,
result
,
name
,
maximum
=
1
,
actionName
=
""
,
TMIN_SLEEP
=
0
,
TMAX_SLEEP
=
0
,
col_num
=
0
,
text
=
""
)
:
def
fillRelatedObjects
(
browser
,
result
,
name
,
maximum
=
1
,
actionName
=
""
,
TMIN_SLEEP
=
0
,
TMAX_SLEEP
=
0
,
col_num
=
0
,
text
=
""
)
:
"""
"""
Function to fill randomly related objetcs
Function to fill randomly related objetcs
@param browser: browser
@param browser: browser
@type browser: Browser
@type browser: Browser
@param result: result
@param result: result
...
@@ -52,7 +52,7 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
...
@@ -52,7 +52,7 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
@param text: Text used to filter
@param text: Text used to filter
@type text: string
@type text: string
"""
"""
# Go to the section linked by the input
# Go to the section linked by the input
result
(
'GoTo '
+
actionName
+
' Relations'
,
browser
.
mainForm
.
getControl
(
result
(
'GoTo '
+
actionName
+
' Relations'
,
browser
.
mainForm
.
getControl
(
name
=
name
).
click
())
name
=
name
).
click
())
...
@@ -64,12 +64,12 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
...
@@ -64,12 +64,12 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
# Check if it is possible to choose many objects
# Check if it is possible to choose many objects
if
(
browser
.
getTransitionMessage
()
==
'Please select one object.'
):
if
(
browser
.
getTransitionMessage
()
==
'Please select one object.'
):
assert
(
maximum
<=
1
)
assert
(
maximum
<=
1
)
# Filter applied the 'col_num' column with text 'text'
# Filter applied the 'col_num' column with text 'text'
if
col_num
!=
0
:
if
col_num
!=
0
:
browser
.
mainForm
.
getListboxControl
(
line_number
=
2
,
column_number
=
col_num
).
value
=
text
browser
.
mainForm
.
getListboxControl
(
line_number
=
2
,
column_number
=
col_num
).
value
=
text
browser
.
mainForm
.
submitDialogUpdate
()
browser
.
mainForm
.
submitDialogUpdate
()
# Get the number of lines
# Get the number of lines
page_stop_number
=
browser
.
etree
.
xpath
(
'//span[@class="listbox-current-page-stop-number"]'
)
page_stop_number
=
browser
.
etree
.
xpath
(
'//span[@class="listbox-current-page-stop-number"]'
)
if
len
(
page_stop_number
)
>
0
:
if
len
(
page_stop_number
)
>
0
:
...
@@ -84,10 +84,10 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
...
@@ -84,10 +84,10 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
# Check the box corresponding to line_number if not already checked
# Check the box corresponding to line_number if not already checked
if
browser
.
mainForm
.
getListboxControl
(
line_number
=
line_number
,
column_number
=
1
).
selected
==
False
:
if
browser
.
mainForm
.
getListboxControl
(
line_number
=
line_number
,
column_number
=
1
).
selected
==
False
:
browser
.
mainForm
.
getListboxControl
(
line_number
=
line_number
,
column_number
=
1
).
click
()
browser
.
mainForm
.
getListboxControl
(
line_number
=
line_number
,
column_number
=
1
).
click
()
result
(
'Submit '
+
actionName
+
' Relations'
,
result
(
'Submit '
+
actionName
+
' Relations'
,
browser
.
mainForm
.
submit
(
name
=
'Base_callDialogMethod:method'
,
browser
.
mainForm
.
submit
(
name
=
'Base_callDialogMethod:method'
,
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
sleep
=
(
TMIN_SLEEP
,
TMAX_SLEEP
)))
# Check whether the changes have been successfully updated
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
...
@@ -96,16 +96,16 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
...
@@ -96,16 +96,16 @@ def fillRelatedObjects(browser, result, name, maximum=1, actionName="", TMIN_SLE
def
fillOneRelatedObjectSimplified
(
browser
,
name
):
def
fillOneRelatedObjectSimplified
(
browser
,
name
):
"""
"""
Function to fill randomly related objetcs
Function to fill randomly related objetcs
@param browser: browser
@param browser: browser
@type browser: Browser
@type browser: Browser
@param name: Name of the input name attribute
@param name: Name of the input name attribute
@type name: string
@type name: string
"""
"""
# Go to the section linked by the input
# Go to the section linked by the input
browser
.
mainForm
.
getControl
(
name
=
name
).
click
()
browser
.
mainForm
.
getControl
(
name
=
name
).
click
()
# Check the status
# Check the status
assert
(
browser
.
getTransitionMessage
()
==
'Please select one object.'
)
assert
(
browser
.
getTransitionMessage
()
==
'Please select one object.'
)
...
@@ -115,7 +115,7 @@ def fillOneRelatedObjectSimplified(browser, name):
...
@@ -115,7 +115,7 @@ def fillOneRelatedObjectSimplified(browser, name):
num_line
=
int
(
page_stop_number
[
0
].
text
)
num_line
=
int
(
page_stop_number
[
0
].
text
)
else
:
else
:
num_line
=
0
num_line
=
0
# Choose randomly one or more objects
# Choose randomly one or more objects
if
num_line
>
0
:
if
num_line
>
0
:
line_number
=
random
.
randint
(
1
,
num_line
)
+
2
line_number
=
random
.
randint
(
1
,
num_line
)
+
2
...
...
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