Commit eec8e2ae authored by Ivan Tyagov's avatar Ivan Tyagov

Testnode uses this format to report

['Person: 372 doc/hour; SaleOrder: 132 doc/hour;']
Thus adjust accordingly. Do not mix http and https.

/reviewed-on !926
parent 29aa4132
......@@ -7,21 +7,32 @@ test_result_lines = context.objectValues(portal_type="Test Result Line", sort_on
# Create a dict containing stats for each test
tests = []
count = 0
results = {}
for tl in test_result_lines:
# Get and parse stdout to a dict
# Get and parse stdout to a dict. this format ['Person: 372 doc/hour; SaleOrder: 132 doc/hour;']
stdout = tl.getProperty('stdout')
if stdout:
count = count + 1
stdout_lines = filter(None, stdout.split('\n'))
current_stats = dict( [(l.split("=")[0].replace(" ", "_"), \
l.split("=")[1].isdigit() and int(l.split("=")[1]) or str(l.split("=")[1])) \
for l in stdout_lines ])
tests.append(current_stats)
for stdout_line in stdout_lines:
tests_list = stdout_line.split(';')
tests_list = [x for x in tests_list if x.strip()!='']
for test in tests_list:
test = test.strip()
test_name = test.split(':')[0]
test_documents_created = test.split(':')[1].replace('doc/hour', '').strip()
# initial init
if test_name not in results.keys():
results[test_name] = []
results[test_name].append({'created_docs': test_documents_created,
'duration':3600})
test_suite = context.getPortalObject().test_suite_module.searchFolder(title=context.getTitle())[0]
xs = map(int, test_suite.getGraphCoordinate())
# testnode usually runs multiple tests, for example for Person and Sale Order creation but
# viewer shows only one graph thus return only one test
tests = results[test_suite_name]
return json.dumps({"test": tests, "xs": xs})
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>test_suite_name, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
"""
Return list of Test Suites being tested by introspecting Test Result Lines
"""
test_suite_list = []
test_result_line_list = context.objectValues(portal_type = 'Test Result Line')
if len(test_result_line_list) > 0:
test_result_line = test_result_line_list[0]
stdout = test_result_line.getProperty('stdout')
context.log(stdout)
for i in stdout.split(';'):
test_suite_list.append(i.split(':')[0].strip())
# remote empty elements
test_suite_list = [x for x in test_suite_list if x.strip()!='']
return test_suite_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestResult_getTestSuiteList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -134,7 +134,9 @@
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -293,4 +295,17 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/render_scalability_graph_links</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>render_scalability_graph_links</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block tal:repeat="test_suite here/TestResult_getTestSuiteList">
<a tal:attributes="href python: 'test_result_graph.html?test_suite_name=' + test_suite">Show the graph for <span tal:content="test_suite"/></a><br/>
</tal:block>
\ No newline at end of file
......@@ -56,7 +56,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode>test_result_graphhttps://192.168.242.72:1234/erp5/portal_skins/erp5_test_results/externalEdit_/test_result_graph.html.zem</unicode> </value>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
......
......@@ -21,7 +21,7 @@ body {
.bullet .title { font-size: 14px; font-weight: bold; }
</style>
<script src="http://d3js.org/d3.v3.js"></script>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script>
......@@ -33,7 +33,8 @@ body {
//get data from erp5
var current_url = $(document)[0].baseURI;
var test_result_url = current_url.substr(0, current_url.lastIndexOf('/'));
var url = test_result_url+"/TestResult_getJsonScalabilityStats";
var test_suite_name = location.search.split('test_suite_name=')[1] ? location.search.split('test_suite_name=')[1] : 'Person';
var url = test_result_url+"/TestResult_getJsonScalabilityStats?test_suite_name=" + test_suite_name;
json = $.ajax({
async: false,
url: url,
......@@ -58,9 +59,11 @@ x-scale may not be respected."+bracket_left+"h1"+bracket_right_end;
}
}
if (xs[0]>1){
document.write("*Speedup and efficiency determined using case n="+xs[0]+" as perfect.");
}
document.write("<h2>Test suite name: " + test_suite_name + "</h2>");
x_max = xs[stats.test.length-1];
// just for fun..
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment