#NEWLINE# def test_xml_format_sample_labels( self ) : #NEWLINE# #INDENT# obj = JUnitXMLReporter ( ) #NEWLINE# obj . engine = EngineEmul ( ) #NEWLINE# obj . parameters = BetterDict ( ) #NEWLINE# path_from_config = tempfile . mktemp ( suffix = '.xml' , prefix = 'junit-xml-sample-labels' , dir = obj . engine . artifacts_dir ) #NEWLINE# obj . parameters . merge ( { #NEWLINE# #INDENT# 'filename' : path_from_config , #NEWLINE# #UNINDENT# } ) #NEWLINE# obj . prepare ( ) #NEWLINE# datapoint = DataPoint ( 0 , [ ] ) #NEWLINE# cumul_data = datapoint [ DataPoint . CUMULATIVE ] #NEWLINE# cumul_data [ '' ] = KPISet . from_dict ( { #NEWLINE# #INDENT# KPISet . AVG_CONN_TIME : 7.890211417203362e-06 , #NEWLINE# KPISet . RESP_TIMES : Counter ( { #NEWLINE# #INDENT# 0.0 : 32160 , #NEWLINE# 0.001 : 24919 , #NEWLINE# 0.002 : 1049 , #NEWLINE# 0.003 : 630 , #NEWLINE# 0.004 : 224 , #NEWLINE# 0.005 : 125 , #NEWLINE# 0.006 : 73 , #NEWLINE# 0.007 : 46 , #NEWLINE# 0.008 : 32 , #NEWLINE# 0.009 : 20 , #NEWLINE# 0.011 : 8 , #NEWLINE# 0.01 : 8 , #NEWLINE# 0.017 : 3 , #NEWLINE# 0.016 : 3 , #NEWLINE# 0.014 : 3 , #NEWLINE# 0.013 : 3 , #NEWLINE# 0.04 : 2 , #NEWLINE# 0.012 : 2 , #NEWLINE# 0.079 : 1 , #NEWLINE# 0.081 : 1 , #NEWLINE# 0.019 : 1 , #NEWLINE# 0.015 : 1 , #NEWLINE# #UNINDENT# } ) , #NEWLINE# KPISet . ERRORS : [ { #NEWLINE# #INDENT# 'msg' : 'Forbidden' , #NEWLINE# 'cnt' : 7373 , #NEWLINE# 'type' : 0 , #NEWLINE# 'urls' : Counter ( { #NEWLINE# #INDENT# 'http://192.168.1.1/anotherquery' : 7373 , #NEWLINE# #UNINDENT# } ) , #NEWLINE# KPISet . RESP_CODES : '403' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# KPISet . STDEV_RESP_TIME : 0.04947974228872108 , #NEWLINE# KPISet . AVG_LATENCY : 0.0002825639815220692 , #NEWLINE# KPISet . RESP_CODES : Counter ( { #NEWLINE# #INDENT# '304' : 29656 , #NEWLINE# '403' : 29656 , #NEWLINE# '200' : 2 , #NEWLINE# #UNINDENT# } ) , #NEWLINE# KPISet . PERCENTILES : { #NEWLINE# #INDENT# '95.0' : 0.001 , #NEWLINE# '0.0' : 0.0 , #NEWLINE# '99.9' : 0.008 , #NEWLINE# '90.0' : 0.001 , #NEWLINE# '100.0' : 0.081 , #NEWLINE# '99.0' : 0.003 , #NEWLINE# '50.0' : 0.0 , #NEWLINE# #UNINDENT# } , #NEWLINE# KPISet . SUCCESSES : 29658 , #NEWLINE# KPISet . SAMPLE_COUNT : 59314 , #NEWLINE# KPISet . CONCURRENCY : 0 , #NEWLINE# KPISet . AVG_RESP_TIME : 0.0005440536804127192 , #NEWLINE# KPISet . FAILURES : 29656 , #NEWLINE# #UNINDENT# } ) #NEWLINE# cumul_data [ 'http://192.168.1.1/somequery' ] = KPISet . from_dict ( { #NEWLINE# #INDENT# KPISet . AVG_CONN_TIME : 9.609548856969457e-06 , #NEWLINE# KPISet . RESP_TIMES : Counter ( { #NEWLINE# #INDENT# 0.0 : 17219 , #NEWLINE# 0.001 : 11246 , #NEWLINE# 0.002 : 543 , #NEWLINE# 0.003 : 341 , #NEWLINE# 0.004 : 121 , #NEWLINE# 0.005 : 66 , #NEWLINE# 0.006 : 36 , #NEWLINE# 0.007 : 33 , #NEWLINE# 0.008 : 18 , #NEWLINE# 0.009 : 12 , #NEWLINE# 0.011 : 6 , #NEWLINE# 0.01 : 5 , #NEWLINE# 0.013 : 2 , #NEWLINE# 0.017 : 2 , #NEWLINE# 0.012 : 2 , #NEWLINE# 0.079 : 1 , #NEWLINE# 0.016 : 1 , #NEWLINE# 0.014 : 1 , #NEWLINE# 0.019 : 1 , #NEWLINE# 0.04 : 1 , #NEWLINE# 0.081 : 1 , #NEWLINE# #UNINDENT# } ) , #NEWLINE# KPISet . ERRORS : [ ] , #NEWLINE# KPISet . STDEV_RESP_TIME : 0.04073402130687656 , #NEWLINE# KPISet . AVG_LATENCY : 1.7196034796682178e-06 , #NEWLINE# KPISet . RESP_CODES : Counter ( { #NEWLINE# #INDENT# '304' : 29656 , #NEWLINE# '200' : 2 , #NEWLINE# #UNINDENT# } ) , #NEWLINE# KPISet . PERCENTILES : { #NEWLINE# #INDENT# '95.0' : 0.001 , #NEWLINE# '0.0' : 0.0 , #NEWLINE# '99.9' : 0.009 , #NEWLINE# '90.0' : 0.001 , #NEWLINE# '100.0' : 0.081 , #NEWLINE# '99.0' : 0.004 , #NEWLINE# '50.0' : 0.0 , #NEWLINE# #UNINDENT# } , #NEWLINE# KPISet . SUCCESSES : 29658 , #NEWLINE# KPISet . SAMPLE_COUNT : 29658 , #NEWLINE# KPISet . CONCURRENCY : 0 , #NEWLINE# KPISet . AVG_RESP_TIME : 0.0005164542450603551 , #NEWLINE# KPISet . FAILURES : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# cumul_data [ 'http://192.168.1.1/anotherquery' ] = KPISet . from_dict ( { #NEWLINE# #INDENT# KPISet . AVG_CONN_TIME : 6.1707580253574335e-06 , #NEWLINE# KPISet . RESP_TIMES : Counter ( { #NEWLINE# #INDENT# 0.0 : 14941 , #NEWLINE# 0.001 : 13673 , #NEWLINE# 0.002 : 506 , #NEWLINE# 0.003 : 289 , #NEWLINE# 0.004 : 103 , #NEWLINE# 0.005 : 59 , #NEWLINE# 0.006 : 37 , #NEWLINE# 0.008 : 14 , #NEWLINE# 0.007 : 13 , #NEWLINE# 0.009 : 8 , #NEWLINE# 0.01 : 3 , #NEWLINE# 0.011 : 2 , #NEWLINE# 0.016 : 2 , #NEWLINE# 0.014 : 2 , #NEWLINE# 0.017 : 1 , #NEWLINE# 0.013 : 1 , #NEWLINE# 0.015 : 1 , #NEWLINE# 0.04 : 1 , #NEWLINE# #UNINDENT# } ) , #NEWLINE# KPISet . ERRORS : [ { #NEWLINE# #INDENT# 'msg' : 'Forbidden' , #NEWLINE# 'cnt' : 7373 , #NEWLINE# 'type' : 0 , #NEWLINE# 'urls' : Counter ( { #NEWLINE# #INDENT# 'http://192.168.1.1/anotherquery' : 7373 , #NEWLINE# #UNINDENT# } ) , #NEWLINE# KPISet . RESP_CODES : '403' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# KPISet . STDEV_RESP_TIME : 0.032465137860758844 , #NEWLINE# KPISet . AVG_LATENCY : 0.0005634272997032645 , #NEWLINE# KPISet . RESP_CODES : Counter ( { #NEWLINE# #INDENT# '403' : 29656 , #NEWLINE# #UNINDENT# } ) , #NEWLINE# KPISet . PERCENTILES : { #NEWLINE# #INDENT# '95.0' : 0.001 , #NEWLINE# '0.0' : 0.0 , #NEWLINE# '99.9' : 0.008 , #NEWLINE# '90.0' : 0.001 , #NEWLINE# '100.0' : 0.04 , #NEWLINE# '99.0' : 0.003 , #NEWLINE# '50.0' : 0.0 , #NEWLINE# #UNINDENT# } , #NEWLINE# KPISet . SUCCESSES : 0 , #NEWLINE# KPISet . SAMPLE_COUNT : 29656 , #NEWLINE# KPISet . CONCURRENCY : 0 , #NEWLINE# KPISet . AVG_RESP_TIME : 0.0005716549770704078 , #NEWLINE# KPISet . FAILURES : 29656 , #NEWLINE# #UNINDENT# } ) #NEWLINE# cumul_data [ 'http://192.168.100.100/somequery' ] = KPISet . from_dict ( { #NEWLINE# #INDENT# KPISet . AVG_CONN_TIME : 9.609548856969457e-06 , #NEWLINE# KPISet . RESP_TIMES : Counter ( { #NEWLINE# #INDENT# 0.0 : 17219 , #NEWLINE# 0.001 : 11246 , #NEWLINE# 0.002 : 543 , #NEWLINE# 0.003 : 341 , #NEWLINE# 0.004 : 121 , #NEWLINE# 0.005 : 66 , #NEWLINE# 0.006 : 36 , #NEWLINE# 0.007 : 33 , #NEWLINE# 0.008 : 18 , #NEWLINE# 0.009 : 12 , #NEWLINE# 0.011 : 6 , #NEWLINE# 0.01 : 5 , #NEWLINE# 0.013 : 2 , #NEWLINE# 0.017 : 2 , #NEWLINE# 0.012 : 2 , #NEWLINE# 0.079 : 1 , #NEWLINE# 0.016 : 1 , #NEWLINE# 0.014 : 1 , #NEWLINE# 0.019 : 1 , #NEWLINE# 0.04 : 1 , #NEWLINE# 0.081 : 1 , #NEWLINE# #UNINDENT# } ) , #NEWLINE# KPISet . ERRORS : [ ] , #NEWLINE# KPISet . STDEV_RESP_TIME : 0.04073402130687656 , #NEWLINE# KPISet . AVG_LATENCY : 1.7196034796682178e-06 , #NEWLINE# KPISet . RESP_CODES : Counter ( { #NEWLINE# #INDENT# '304' : 29656 , #NEWLINE# '200' : 2 , #NEWLINE# #UNINDENT# } ) , #NEWLINE# KPISet . PERCENTILES : { #NEWLINE# #INDENT# '95.0' : 0.001 , #NEWLINE# '0.0' : 0.0 , #NEWLINE# '99.9' : 0.009 , #NEWLINE# '90.0' : 0.001 , #NEWLINE# '100.0' : 0.081 , #NEWLINE# '99.0' : 0.004 , #NEWLINE# '50.0' : 0.0 , #NEWLINE# #UNINDENT# } , #NEWLINE# KPISet . SUCCESSES : 29658 , #NEWLINE# KPISet . SAMPLE_COUNT : 29658 , #NEWLINE# KPISet . CONCURRENCY : 0 , #NEWLINE# KPISet . AVG_RESP_TIME : 0.0005164542450603551 , #NEWLINE# KPISet . FAILURES : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# obj . aggregated_second ( path_from_config ) #NEWLINE# obj . post_process ( ) #NEWLINE# with open ( obj . report_file_path , 'rb' ) as fds : #NEWLINE# #INDENT# f_contents = fds . read ( ) #NEWLINE# #UNINDENT# xml_tree = etree . fromstring ( f_contents ) #NEWLINE# self . assertEqual ( 'testsuite' , xml_tree . tag ) #NEWLINE# self . assertEqual ( 3 , len ( xml_tree . getchildren ( ) ) ) #NEWLINE# self . assertEqual ( 'testcase' , xml_tree . getchildren ( ) [ 0 ] . tag ) #NEWLINE# self . assertEqual ( 'error' , xml_tree . getchildren ( ) [ 0 ] . getchildren ( ) [ 0 ] . tag ) #NEWLINE# self . assertEqual ( 'error' , xml_tree . getchildren ( ) [ 0 ] . getchildren ( ) [ 0 ] . tag ) #NEWLINE# self . assertListEqual ( [ 'sample_labels' , 'bzt' ] , xml_tree . values ( ) )