예제 #1
0
    def test_stepping_tg_ramp_proportion(self):
        """
        Tested with concurrency proportions
        :return:
        """
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = BetterDict()
        obj.engine.config.merge({'execution': {'steps': 5, 'concurrency': 170,
                                               'scenario': {'script': 'tests/jmx/stepping_ramp_up.jmx'},
                                               'ramp-up': '1m', 'distributed': ['127.0.0.1'], 'hold-for': '2m'}})
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.execution['concurrency'] = 100  # from 170 to 100
        obj.execution['steps'] = 4  # from 5 to 4
        obj.prepare()
        load = obj.get_load()
        orig_xml_tree = etree.fromstring(open(obj.original_jmx, "rb").read())
        modified_xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        mod_stepping_tgs = modified_xml_tree.findall(".//kg.apc.jmeter.threads.SteppingThreadGroup")
        orig_tgs = orig_xml_tree.findall(".//ThreadGroup")
        self.assertEqual(len(mod_stepping_tgs), len(orig_tgs))
        orig_summ_cnc = sum([int(x.find(".//stringProp[@name='ThreadGroup.num_threads']").text) for x in orig_tgs])
        for orig_th, step_th in zip(orig_tgs, mod_stepping_tgs):
            orig_num_threads = int(orig_th.find(".//stringProp[@name='ThreadGroup.num_threads']").text)
            mod_num_threads = int(step_th.find(".//stringProp[@name='ThreadGroup.num_threads']").text)

            self.assertEqual(round(orig_num_threads * (float(load.concurrency) / orig_summ_cnc)), mod_num_threads)
            self.assertEqual(step_th.find(".//stringProp[@name='Start users period']").text,
                             str(int(load.ramp_up / load.steps)))
            self.assertEqual(step_th.find(".//stringProp[@name='Start users count']").text,
                             str(int(ceil(float(load.concurrency) / orig_summ_cnc * orig_num_threads / load.steps))))
예제 #2
0
    def test_iterations_loop_bug(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config[Provisioning.PROV] = 'test'
        obj.execution = BetterDict()
        obj.execution.merge({"iterations": 10, "scenario": {"script": __dir__() + "/../jmx/http.jmx"}})
        obj.prepare()
        modified_xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        tg = modified_xml_tree.find(".//ThreadGroup")
        loop_ctrl = tg.find(".//elementProp[@name='ThreadGroup.main_controller']")
        tg_loops = loop_ctrl.find(".//stringProp[@name='LoopController.loops']")
        tg_forever = loop_ctrl.find(".//boolProp[@name='LoopController.continue_forever']")
        self.assertEqual(tg_loops.text, "10")
        self.assertEqual(tg_forever.text, "false")

        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config[Provisioning.PROV] = 'test'
        obj.execution = BetterDict()
        obj.execution.merge({"scenario": {"script": __dir__() + "/../jmx/http.jmx"}})
        obj.prepare()
        modified_xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        tg = modified_xml_tree.find(".//ThreadGroup")
        loop_ctrl = tg.find(".//elementProp[@name='ThreadGroup.main_controller']")
        tg_loops = loop_ctrl.find("*[@name='LoopController.loops']")
        tg_forever = loop_ctrl.find(".//boolProp[@name='LoopController.continue_forever']")
        self.assertEqual(tg_loops.text, "1")  # default value, not disabled
        self.assertEqual(tg_forever.text, "false")
예제 #3
0
    def test_stepping_tg_ramp_no_proportion(self):
        """
        Tested without concurrency proportions
        :return:
        """
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = BetterDict()
        obj.engine.config.merge(yaml.load(open("tests/yaml/stepping_ramp_up.yml").read()))
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.prepare()
        load = obj.get_load()
        orig_xml_tree = etree.fromstring(open(obj.original_jmx, "rb").read())
        modified_xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        mod_stepping_tgs = modified_xml_tree.findall(".//kg.apc.jmeter.threads.SteppingThreadGroup")
        orig_tgs = orig_xml_tree.findall(".//ThreadGroup")
        self.assertEqual(len(mod_stepping_tgs), len(orig_tgs))
        for orig_th, step_th in zip(orig_tgs, mod_stepping_tgs):
            orig_num_threads = int(orig_th.find(".//stringProp[@name='ThreadGroup.num_threads']").text)
            mod_num_threads = int(step_th.find(".//stringProp[@name='ThreadGroup.num_threads']").text)
            self.assertEqual(orig_num_threads, mod_num_threads)

            self.assertEqual(step_th.find(".//stringProp[@name='Start users period']").text,
                             str(int(load.ramp_up / load.steps)))
            self.assertEqual(step_th.find(".//stringProp[@name='Start users count']").text,
                             str(int(orig_num_threads / load.steps)))
예제 #4
0
    def test_distributed_th_hostnames(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.execution.merge(
            {"scenario": {
                "script": __dir__() + "/../jmx/http.jmx"
            }})
        obj.distributed_servers = ["127.0.0.1", "127.0.0.1"]
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        thread_groups = xml_tree.findall(".//ThreadGroup")
        prepend_str = r"${__machineName()}"
        for thread_group in thread_groups:
            self.assertTrue(
                thread_group.attrib["testname"].startswith(prepend_str))

        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = json.loads(
            open(__dir__() + "/../json/get-post.json").read())
        obj.execution = obj.engine.config['execution']
        obj.settings.merge(obj.engine.config.get("modules").get("jmeter"))
        obj.distributed_servers = ["127.0.0.1", "127.0.0.1"]
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        thread_groups = xml_tree.findall(".//ThreadGroup")
        prepend_str = r"${__machineName()}"
        for thread_group in thread_groups:
            self.assertFalse(
                thread_group.attrib["testname"].startswith(prepend_str))
예제 #5
0
    def test_new_extractor(self):
        """ versions after 3.0 use integrated JSON extractor """
        self.configure(scenario={"requests": [{
            "url": "http://blazedemo.com",
            "extract-jsonpath": {
                "IP": "$.net[0].ip",
                "URL": {"jsonpath": "$.url[1]", "default": "d1", "scope": "all", "concat": True, "from_variable": "V"},
                "ID": {"jsonpath": "$.net[3].id", "default": "d2", "scope": "children", "concat": True},
                "NuM": {"jsonpath": "$.num", "scope": "variable", "from-variable": "JMVaR", "match_no": 3},
            }}]},
            version=3.3)
        self.obj.save(self.jmx)
        xml_tree = etree.fromstring(open(self.jmx, "rb").read())
        cfg = self.get_internal_json_extractor_config(xml_tree)
        self.assertEqual(4, len(cfg))
        target = {'IP': {'from_variable': None, 'default': 'NOT_FOUND', 'match_no': '-1',
                         'jsonpath': '$.net[0].ip', 'scope': None, 'concat': None},
                  'URL': {'from_variable': None, 'default': 'd1', 'match_no': '-1',
                          'jsonpath': '$.url[1]', 'scope': None, 'concat': None},
                  'ID': {'from_variable': None, 'default': 'd2', 'match_no': '-1',
                         'jsonpath': '$.net[3].id', 'scope': None, 'concat': None},
                  'NuM': {'from_variable': 'JMVaR', 'default': 'NOT_FOUND', 'match_no': '-1',
                          'jsonpath': '$.num', 'scope': 'variable', 'concat': None}}

        self.assertEqual(target, cfg)
예제 #6
0
    def test_duration_loops_bug(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config[Provisioning.PROV] = 'test'
        obj.execution = BetterDict()
        obj.execution.merge({
            "concurrency": 10,
            "ramp-up": 15,
            "hold-for": "2m",
            "scenario": {
                "script": __dir__() + "/../jmx/http.jmx"
            }
        })
        obj.prepare()

        modified_xml_tree = etree.fromstring(
            open(obj.modified_jmx, "rb").read())
        tg = modified_xml_tree.find(".//ThreadGroup")
        loop_ctrl = tg.find(
            ".//elementProp[@name='ThreadGroup.main_controller']")
        tg_loops = loop_ctrl.find(".//intProp[@name='LoopController.loops']")
        tg_forever = loop_ctrl.find(
            ".//boolProp[@name='LoopController.continue_forever']")
        self.assertEqual(tg_loops.text, "-1")
        self.assertEqual(tg_forever.text, "false")
예제 #7
0
 def test_user_def_vars_override(self):
     obj = JMeterExecutor()
     obj.engine = EngineEmul()
     obj.engine.config.merge({
         'execution': {
             'concurrency': 200,
             'throughput': 100,
             'hold-for': '1m',
             'scenario': {
                 'variables': {
                     'my_var': 'http://demo.blazemeter.com/api/user',
                     'myvar2': 'val2'
                 },
                 'properties': {
                     'log_level.jmeter': 'DEBUG'
                 },
                 'script': __dir__() + '/../jmx/http.jmx'
             }
         }
     })
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
     udv_elements = xml_tree.findall(".//Arguments[@testclass='Arguments']")
     self.assertEqual(1, len(udv_elements))
예제 #8
0
    def test_add_shaper_constant(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = BetterDict()
        obj.engine.config.merge({
            'execution': {
                'concurrency': 200,
                'throughput': 100,
                'hold-for': '1m',
                'scenario': {
                    'script': __dir__() + '/../jmx/http.jmx'
                }
            }
        })
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        timer_ = ".//kg.apc.jmeter.timers.VariableThroughputTimer"
        timer_ += "[@testclass='kg.apc.jmeter.timers.VariableThroughputTimer']"
        shaper_elements = xml_tree.findall(timer_)
        self.assertEqual(1, len(shaper_elements))
        shaper_coll_element = shaper_elements[0].find(
            ".//collectionProp[@name='load_profile']")

        self.assertEqual(
            "100",
            shaper_coll_element.find(".//stringProp[@name='49']").text)
        self.assertEqual(
            "100",
            shaper_coll_element.find(".//stringProp[@name='1567']").text)
        self.assertEqual(
            "60",
            shaper_coll_element.find(".//stringProp[@name='53']").text)
예제 #9
0
 def test_old_jmeter(self):
     """ versions before 3.0 must use JSON plugin for extracting purposes """
     self.configure(scenario={
         "requests": [{
             "url": "http://blazedemo.com",
             "extract-jsonpath": {
                 "IP": "$.net[0].ip",
                 "URL": {
                     "jsonpath": "$.net[1].url",
                     "default": "def",
                     "from-variable": "Jm_VaR"
                 }
             }
         }]
     },
                    version="2.13")
     self.obj.save(self.jmx)
     xml_tree = etree.fromstring(open(self.jmx, "rb").read())
     cfg = self.get_plugin_json_extractor_config(xml_tree)
     self.assertEqual(2, len(cfg))
     target = {
         "IP": {
             "jsonpath": "$.net[0].ip",
             "default": "NOT_FOUND",
             "from_variable": None
         },
         "URL": {
             "jsonpath": "$.net[1].url",
             "default": "def",
             "from_variable": "Jm_VaR"
         }
     }
     self.assertEqual(target, cfg)
예제 #10
0
 def test_css_jquery_extractor(self):
     obj = JMeterExecutor()
     handler = RecordingHandler()
     obj.log.addHandler(handler)
     obj.engine = EngineEmul()
     obj.engine.config = json.loads(open(__dir__() + "/../json/get-post.json").read())
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     target_jmx = os.path.join(obj.engine.artifacts_dir, "requests.jmx")
     modified_xml_tree = etree.fromstring(open(target_jmx, "rb").read())
     jq_css_extractors = modified_xml_tree.findall(".//HtmlExtractor")
     self.assertEqual(2, len(jq_css_extractors))
     simplified_extractor = modified_xml_tree.find(".//HtmlExtractor[@testname='Get name1']")
     self.assertEqual(simplified_extractor.find(".//stringProp[@name='HtmlExtractor.refname']").text, "name1")
     self.assertEqual(simplified_extractor.find(".//stringProp[@name='HtmlExtractor.expr']").text,
                      "input[name~=my_input]")
     self.assertEqual(simplified_extractor.find(".//stringProp[@name='HtmlExtractor.attribute']").text, None)
     self.assertEqual(simplified_extractor.find(".//stringProp[@name='HtmlExtractor.match_number']").text, "0")
     self.assertEqual(simplified_extractor.find(".//stringProp[@name='HtmlExtractor.default']").text, "NOT_FOUND")
     full_form_extractor = modified_xml_tree.find(".//HtmlExtractor[@testname='Get name2']")
     self.assertEqual(full_form_extractor.find(".//stringProp[@name='HtmlExtractor.refname']").text, "name2")
     self.assertEqual(full_form_extractor.find(".//stringProp[@name='HtmlExtractor.expr']").text,
                      "input[name=JMeter]")
     self.assertEqual(full_form_extractor.find(".//stringProp[@name='HtmlExtractor.attribute']").text, "value")
     self.assertEqual(full_form_extractor.find(".//stringProp[@name='HtmlExtractor.match_number']").text, "1")
     self.assertEqual(full_form_extractor.find(".//stringProp[@name='HtmlExtractor.default']").text, "NV_JMETER")
     obj.log.removeHandler(handler)
예제 #11
0
 def __check_path_resource_files(self, jmx_file_path, exclude_jtls=False, reverse_check=False):
     xml_tree = etree.fromstring(open(jmx_file_path, "rb").read())
     exclude_elements = ['kg.apc.jmeter.jmxmon.JMXMonCollector', 'JSR223Listener',
                         'kg.apc.jmeter.vizualizers.CorrectedResultCollector',
                         'kg.apc.jmeter.reporters.FlexibleFileWriter', 'BSFListener',
                         'kg.apc.jmeter.dbmon.DbMonCollector', 'BeanShellListener', 'MailerResultCollector',
                         'kg.apc.jmeter.perfmon.PerfMonCollector', 'ResultCollector',
                         'kg.apc.jmeter.vizualizers.CompositeResultCollector',
                         'kg.apc.jmeter.reporters.LoadosophiaUploader']
     search_patterns = ["File.path", "filename", "BeanShellSampler.filename"]
     for pattern in search_patterns:
         resource_elements = xml_tree.findall(".//stringProp[@name='%s']" % pattern)
         for resource_element in resource_elements:
             parent = resource_element.getparent()
             parent_disabled = False
             while parent is not None:
                 if parent.get('enabled') == 'false' or parent.tag in exclude_elements:
                     parent_disabled = True
                     break
                 parent = parent.getparent()
             if resource_element.text and parent_disabled is False:
                 if exclude_jtls:
                     if not resource_element.text.endswith('.jtl'):
                         if not reverse_check:
                             self.assertEqual("", os.path.dirname(resource_element.text))
                         else:
                             self.assertNotEqual("", os.path.dirname(resource_element.text))
                 else:
                     if not reverse_check:
                         self.assertEqual("", os.path.dirname(resource_element.text))
                     else:
                         self.assertNotEqual("", os.path.dirname(resource_element.text))
예제 #12
0
    def test_convert_tgroups_load_modifications(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config[Provisioning.PROV] = 'test'
        obj.execution = BetterDict()
        obj.execution.merge({
            "iterations": 20,
            "ramp-up": 10,
            "hold-for": "2m",
            "scenario": {"script": __dir__() + "/../jmx/SteppingThreadGroup.jmx"}
        })
        obj.prepare()
        modified_xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        st_tg = modified_xml_tree.find(".//kg.apc.jmeter.threads.SteppingThreadGroup")
        self.assertEqual(st_tg, None)
        ul_tg = modified_xml_tree.find(".//kg.apc.jmeter.threads.UltimateThreadGroup")
        self.assertEqual(ul_tg, None)

        converted_st_tg = modified_xml_tree.find(".//ThreadGroup[@testname='stepping tg']")

        loop_ctrl = converted_st_tg.find(".//elementProp[@name='ThreadGroup.main_controller']")
        tg_loops = loop_ctrl.find(".//*[@name='LoopController.loops']")
        tg_forever = loop_ctrl.find(".//boolProp[@name='LoopController.continue_forever']")
        self.assertEqual(tg_loops.text, "20")
        self.assertEqual(tg_forever.text, "false")

        st_tg_concurrency = converted_st_tg.find(".//stringProp[@name='ThreadGroup.num_threads']")
        self.assertEqual(st_tg_concurrency.text, "123")
예제 #13
0
    def test_dns_cache_mgr_script(self):
        """

        :return:
        """
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = BetterDict()
        obj.engine.config.merge({'execution': {'ramp-up': 10, 'throughput': 2, 'hold-for': 20, 'concurrency': 5,
                                               'scenario': {'think-time': '0.75s', 'script': 'tests/jmx/http.jmx'}},
                                 'modules': {'jmeter': {'system-properties': {'any_prop': 'true'},
                                                        'properties': {'log_level.jmeter': 'WARN',
                                                                       'log_level.jmeter.threads': 'DEBUG',
                                                                       'my-hostname': 'www.pre-test.com'}}}})
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.settings.merge(obj.engine.config.get("modules").get("jmeter"))
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        dns_managers = xml_tree.findall(".//DNSCacheManager")
        # 0 dns_managers
        self.assertEqual(len(dns_managers), 0)
        sys_prop = open(os.path.join(obj.engine.artifacts_dir, "system.properties")).read()
        self.assertTrue("any_prop=true" in sys_prop)
        self.assertFalse("sun.net.inetaddr.ttl=0" in sys_prop)
예제 #14
0
 def __check_path_resource_files(self, jmx_file_path, exclude_jtls=False, reverse_check=False):
     xml_tree = etree.fromstring(open(jmx_file_path, "rb").read())
     search_patterns = ["File.path", "filename", "BeanShellSampler.filename"]
     for pattern in search_patterns:
         resource_elements = xml_tree.findall(".//stringProp[@name='%s']" % pattern)
         for resource_element in resource_elements:
             parent = resource_element.getparent()
             parent_disabled = False
             while parent is not None:
                 if parent.get('enabled') == 'false':
                     parent_disabled = True
                     break
                 parent = parent.getparent()
             if resource_element.text and parent_disabled is False:
                 if exclude_jtls:
                     if not resource_element.text.endswith('.jtl'):
                         if not reverse_check:
                             self.assertEqual("", os.path.dirname(resource_element.text))
                         else:
                             self.assertNotEqual("", os.path.dirname(resource_element.text))
                 else:
                     if not reverse_check:
                         self.assertEqual("", os.path.dirname(resource_element.text))
                     else:
                         self.assertNotEqual("", os.path.dirname(resource_element.text))
예제 #15
0
 def test_user_def_vars_from_requests(self):
     obj = JMeterExecutor()
     obj.engine = EngineEmul()
     obj.engine.config = json.loads(open("tests/json/get-post.json").read())
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
     udv_elements = xml_tree.findall(".//Arguments[@testclass='Arguments']")
     self.assertEqual(1, len(udv_elements))
예제 #16
0
 def test_user_def_vars_override(self):
     obj = JMeterExecutor()
     obj.engine = EngineEmul()
     obj.engine.config.merge(yaml.load(open("tests/yaml/user_def_vars.yml").read()))
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
     udv_elements = xml_tree.findall(".//Arguments[@testclass='Arguments']")
     self.assertEqual(1, len(udv_elements))
예제 #17
0
 def test_no_cookies(self):
     self.configure(scenario={
         "requests": ["http://localhost"],
         "store-cookie": False
     })
     self.obj.save(self.jmx)
     xml_tree = etree.fromstring(open(self.jmx, "rb").read())
     include = xml_tree.find(
         ".//boolProp[@name='CookieManager.clearEachIteration']")
     self.assertIsNone(include)
예제 #18
0
 def test_user_def_vars_override(self):
     obj = JMeterExecutor()
     obj.engine = EngineEmul()
     obj.engine.config.merge({'execution': {'concurrency': 200, 'throughput': 100, 'hold-for': '1m', 'scenario': {
         'variables': {'my_var': 'http://demo.blazemeter.com/api/user', 'myvar2': 'val2'},
         'properties': {'log_level.jmeter': 'DEBUG'}, 'script': 'tests/jmx/http.jmx'}}})
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
     udv_elements = xml_tree.findall(".//Arguments[@testclass='Arguments']")
     self.assertEqual(1, len(udv_elements))
예제 #19
0
 def test_transaction_include_timers(self):
     self.configure(scenario={"requests": [{
         "transaction": "tran",
         "include-timers": True,
         "do": ["http://blazedemo.com/"]}]
     })
     self.obj.save(self.jmx)
     xml_tree = etree.fromstring(open(self.jmx, "rb").read())
     include = xml_tree.find(".//TransactionController/boolProp[@name='TransactionController.includeTimers']")
     self.assertIsNotNone(include)
     self.assertEqual(include.text, 'true')
예제 #20
0
    def test_xml_format_passfail(self):
        obj = JUnitXMLReporter()
        obj.engine = EngineEmul()
        obj.parameters = BetterDict()

        pass_fail1 = PassFailStatus()

        fc1_triggered = DataCriteria({'stop': True, 'label': 'Sample 1 Triggered', 'fail': True,
                                      'timeframe': -1, 'threshold': '150ms', 'condition': '<', 'subject': 'avg-rt'},
                                     pass_fail1)

        fc1_not_triggered = DataCriteria({'stop': True, 'label': 'Sample 1 Not Triggered', 'fail': True,
                                          'timeframe': -1, 'threshold': '300ms', 'condition': '>', 'subject': 'avg-rt'},
                                         pass_fail1)

        pass_fail2 = PassFailStatus()

        fc2_triggered = DataCriteria({'stop': True, 'label': 'Sample 2 Triggered', 'fail': True, 'timeframe': -1,
                                      'threshold': '150ms', 'condition': '<=', 'subject': 'avg-rt'}, pass_fail1)

        fc2_not_triggered = DataCriteria({'stop': True, 'label': 'Sample 2 Not Triggered', 'fail': True,
                                          'timeframe': -1, 'threshold': '300ms', 'condition': '=', 'subject': 'avg-rt'},
                                         pass_fail1)

        pass_fail1.criterias.append(fc1_triggered)
        pass_fail1.criterias.append(fc1_not_triggered)
        pass_fail2.criterias.append(fc2_triggered)
        pass_fail2.criterias.append(fc2_not_triggered)

        fc1_triggered.is_triggered = True
        fc2_triggered.is_triggered = True

        obj.engine.reporters.append(pass_fail1)
        obj.engine.reporters.append(pass_fail2)
        obj.engine.reporters.append(BlazeMeterUploader())

        path_from_config = tempfile.mktemp(suffix='.xml', prefix='junit-xml_passfail', dir=obj.engine.artifacts_dir)

        obj.parameters.merge({"filename": path_from_config, "data-source": "pass-fail"})
        obj.prepare()
        obj.last_second = DataPoint(0)
        obj.post_process()

        with open(obj.report_file_path, 'rb') as fds:
            f_contents = fds.read()

        xml_tree = etree.fromstring(f_contents)
        self.assertEqual('testsuite', xml_tree.tag)
        self.assertEqual(4, len(xml_tree.getchildren()))
        self.assertEqual('testcase', xml_tree.getchildren()[0].tag)
        self.assertEqual('error', xml_tree.getchildren()[0].getchildren()[0].tag)
        self.assertEqual('error', xml_tree.getchildren()[2].getchildren()[0].tag)
예제 #21
0
 def test_convert_tgroups_no_load(self):
     obj = JMeterExecutor()
     obj.engine = EngineEmul()
     obj.engine.config[Provisioning.PROV] = 'test'
     obj.execution = BetterDict()
     obj.execution.merge({
         "scenario": {"script": __dir__() + "/../jmx/SteppingThreadGroup.jmx"}
     })
     obj.prepare()
     modified_xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
     st_tg = modified_xml_tree.find(".//kg.apc.jmeter.threads.SteppingThreadGroup")
     self.assertNotEqual(st_tg, None)
     ul_tg = modified_xml_tree.find(".//kg.apc.jmeter.threads.UltimateThreadGroup")
     self.assertNotEqual(ul_tg, None)
예제 #22
0
    def test_internal_extractor_config_reader(self):
        xml_tree = etree.fromstring(
            open(RESOURCES_DIR + "jmeter/jmx/json_extractors.jmx",
                 "rb").read())
        target = {
            'v1': {
                'from_variable': None,
                'default': 'd1',
                'match_no': 'm1',
                'jsonpath': 'e1',
                'scope': None,
                'concat': None
            },
            'v2': {
                'from_variable': None,
                'default': 'd2',
                'match_no': 'm2',
                'jsonpath': 'e2',
                'scope': None,
                'concat': None
            },
            'v3': {
                'from_variable': None,
                'default': 'd3',
                'match_no': 'm3',
                'jsonpath': 'e3',
                'scope': None,
                'concat': None
            },
            'v4': {
                'from_variable': 'var4',
                'default': 'd4',
                'match_no': '4',
                'jsonpath': 'e4',
                'scope': 'variable',
                'concat': None
            },
            'v-empty': {
                'from_variable': None,
                'default': None,
                'match_no': None,
                'jsonpath': 'p1',
                'scope': None,
                'concat': None
            }
        }

        xml = self.get_internal_json_extractor_config(xml_tree)
        self.assertEqual(target, xml)
예제 #23
0
 def test_dns_cache_mgr_scenario(self):
     """
     No system properties
     :return:
     """
     obj = JMeterExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({"scenario": {"script": "tests/jmx/http.jmx"}})
     obj.prepare()
     xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
     dns_element = xml_tree.findall(".//DNSCacheManager")
     # no dns manager when using jmx, no system.properties file
     self.assertEqual(len(dns_element), 0)
     arts = os.listdir(obj.engine.artifacts_dir)
     self.assertNotIn("system.properties", arts)
예제 #24
0
파일: soapui.py 프로젝트: andy7i/taurus
    def _extract_headers(self, config_elem):
        headers_settings = config_elem.find(
            './/con:settings/con:setting[@id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"]',
            namespaces=self.NAMESPACES)
        if headers_settings is None:
            return None
        headers = etree.fromstring(headers_settings.text)
        if "{" + self.NAMESPACES['con'] + "}" + "entry" == headers.tag:
            entries = [headers]
        else:
            entries = headers.findall(".//con:entry", namespaces=self.NAMESPACES)

        headers = {entry.get('key'): entry.get('value')
                   for entry in entries}
        return headers
예제 #25
0
    def test_distributed_th_hostnames(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.execution.merge({"scenario": {"script": "tests/jmx/http.jmx"}})
        obj.distributed_servers = ["127.0.0.1", "127.0.0.1"]
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        thread_groups = xml_tree.findall(".//ThreadGroup")
        prepend_str = r"${__machineName()}"
        for thread_group in thread_groups:
            self.assertTrue(thread_group.attrib["testname"].startswith(prepend_str))

        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = json.loads(open(__dir__() + "/../../tests/json/get-post.json").read())
        obj.execution = obj.engine.config['execution']
        obj.settings.merge(obj.engine.config.get("modules").get("jmeter"))
        obj.distributed_servers = ["127.0.0.1", "127.0.0.1"]
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        thread_groups = xml_tree.findall(".//ThreadGroup")
        prepend_str = r"${__machineName()}"
        for thread_group in thread_groups:
            self.assertFalse(thread_group.attrib["testname"].startswith(prepend_str))
예제 #26
0
    def _extract_headers(self, config_elem):
        headers_settings = config_elem.find(
            './/con:settings/con:setting[@id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"]',
            namespaces=self.NAMESPACES)
        if headers_settings is None:
            return None
        headers = etree.fromstring(headers_settings.text)
        if "{" + self.NAMESPACES['con'] + "}" + "entry" == headers.tag:
            entries = [headers]
        else:
            entries = headers.findall(".//con:entry",
                                      namespaces=self.NAMESPACES)

        headers = {entry.get('key'): entry.get('value') for entry in entries}
        return headers
예제 #27
0
    def test_body_parse(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = json.loads(open("tests/json/get-post.json").read())
        obj.execution = obj.engine.config['execution']
        obj.prepare()

        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        sampler_element = xml_tree.findall(".//HTTPSamplerProxy[@testname='With body params']")
        arguments_element_prop = sampler_element[0][0]
        self.assertEqual(7, len(sampler_element[0].getchildren()))
        self.assertEqual(1, len(arguments_element_prop.getchildren()))
        self.assertEqual(2, len(arguments_element_prop[0].getchildren()))
        self.assertEqual(1, len(arguments_element_prop[0].findall(".//elementProp[@name='param1']")))
        self.assertEqual(1, len(arguments_element_prop.findall(".//elementProp[@name='param2']")))
예제 #28
0
    def test_internal_extractor_config_reader(self):
        xml_tree = etree.fromstring(open(RESOURCES_DIR + "jmeter/jmx/json_extractors.jmx", "rb").read())
        target = {'v1': {'from_variable': None, 'default': 'd1',
                         'match_no': 'm1', 'jsonpath': 'e1', 'scope': None, 'concat': None},
                  'v2': {'from_variable': None, 'default': 'd2',
                         'match_no': 'm2', 'jsonpath': 'e2', 'scope': None, 'concat': None},
                  'v3': {'from_variable': None, 'default': 'd3',
                         'match_no': 'm3', 'jsonpath': 'e3', 'scope': None, 'concat': None},
                  'v4': {'from_variable': 'var4', 'default': 'd4',
                         'match_no': '4', 'jsonpath': 'e4', 'scope': 'variable', 'concat': None},
                  'v-empty': {'from_variable': None, 'default': None,
                              'match_no': None, 'jsonpath': 'p1', 'scope': None, 'concat': None}}

        xml = self.get_internal_json_extractor_config(xml_tree)
        self.assertEqual(target, xml)
예제 #29
0
 def test_transaction_include_timers(self):
     self.configure(
         scenario={
             "requests": [{
                 "transaction": "tran",
                 "include-timers": True,
                 "do": ["http://blazedemo.com/"]
             }]
         })
     self.obj.save(self.jmx)
     xml_tree = etree.fromstring(open(self.jmx, "rb").read())
     include = xml_tree.find(
         ".//TransactionController/boolProp[@name='TransactionController.includeTimers']"
     )
     self.assertIsNotNone(include)
     self.assertEqual(include.text, 'true')
예제 #30
0
    def test_add_shaper_constant(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = BetterDict()
        obj.engine.config.merge(yaml.load(open("tests/yaml/throughput_constant.yml").read()))
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        shaper_elements = xml_tree.findall(
            ".//kg.apc.jmeter.timers.VariableThroughputTimer[@testclass='kg.apc.jmeter.timers.VariableThroughputTimer']")
        self.assertEqual(1, len(shaper_elements))
        shaper_coll_element = shaper_elements[0].find(".//collectionProp[@name='load_profile']")

        self.assertEqual("100", shaper_coll_element.find(".//stringProp[@name='49']").text)
        self.assertEqual("100", shaper_coll_element.find(".//stringProp[@name='1567']").text)
        self.assertEqual("60", shaper_coll_element.find(".//stringProp[@name='53']").text)
예제 #31
0
    def test_http_request_defaults(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = json.loads(
            open(__dir__() + "/../json/get-post.json").read())
        obj.execution = obj.engine.config['execution']
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        default_elements = xml_tree.findall(
            ".//ConfigTestElement[@testclass='ConfigTestElement']")
        self.assertEqual(1, len(default_elements))

        default_element = default_elements[0]
        self.assertEqual(
            "www.somehost.com",
            default_element.find(
                ".//stringProp[@name='HTTPSampler.domain']").text)
        self.assertEqual(
            "884",
            default_element.find(
                ".//stringProp[@name='HTTPSampler.port']").text)
        self.assertEqual(
            "https",
            default_element.find(
                ".//stringProp[@name='HTTPSampler.protocol']").text)
        self.assertEqual(
            "true",
            default_element.find(
                ".//boolProp[@name='HTTPSampler.image_parser']").text)
        self.assertEqual(
            "true",
            default_element.find(
                ".//boolProp[@name='HTTPSampler.concurrentDwn']").text)
        self.assertEqual(
            "10",
            default_element.find(
                ".//stringProp[@name='HTTPSampler.concurrentPool']").text)
        # all keepalives in requests are disabled
        requests = xml_tree.findall(
            ".//HTTPSamplerProxy[@testclass='HTTPSamplerProxy']")
        for request in requests:
            self.assertEqual(
                "false",
                request.find(
                    ".//boolProp[@name='HTTPSampler.use_keepalive']").text)
예제 #32
0
    def test_add_shaper_constant(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = BetterDict()
        obj.engine.config.merge({'execution': {'concurrency': 200, 'throughput': 100, 'hold-for': '1m',
                                               'scenario': {'script': __dir__()+'/../jmx/http.jmx'}}})
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        shaper_elements = xml_tree.findall(
            ".//kg.apc.jmeter.timers.VariableThroughputTimer[@testclass='kg.apc.jmeter.timers.VariableThroughputTimer']")
        self.assertEqual(1, len(shaper_elements))
        shaper_coll_element = shaper_elements[0].find(".//collectionProp[@name='load_profile']")

        self.assertEqual("100", shaper_coll_element.find(".//stringProp[@name='49']").text)
        self.assertEqual("100", shaper_coll_element.find(".//stringProp[@name='1567']").text)
        self.assertEqual("60", shaper_coll_element.find(".//stringProp[@name='53']").text)
예제 #33
0
 def test_plugin_extractor_config_reader(self):
     xml_tree = etree.fromstring(
         open(RESOURCES_DIR + "jmeter/jmx/json_extractors.jmx",
              "rb").read())
     target = {
         'pv1': {
             'default': 'pd1',
             'from_variable': 'pJV',
             'jsonpath': 'pe1'
         },
         'pv2': {
             'default': None,
             'from_variable': None,
             'jsonpath': 'pe2'
         }
     }
     self.assertEqual(target,
                      self.get_plugin_json_extractor_config(xml_tree))
예제 #34
0
 def test_old_jmeter(self):
     """ versions before 3.0 must use JSON plugin for extracting purposes """
     self.configure(scenario={"requests": [{
             "url": "http://blazedemo.com",
             "extract-jsonpath": {
                 "IP": "$.net[0].ip",
                 "URL": {
                     "jsonpath": "$.net[1].url",
                     "default": "def",
                     "from-variable": "Jm_VaR"}}}]},
         version="2.13")
     self.obj.save(self.jmx)
     xml_tree = etree.fromstring(open(self.jmx, "rb").read())
     cfg = self.get_plugin_json_extractor_config(xml_tree)
     self.assertEqual(2, len(cfg))
     target = {
         "IP": {"jsonpath": "$.net[0].ip", "default": "NOT_FOUND", "from_variable": None},
         "URL": {"jsonpath": "$.net[1].url", "default": "def", "from_variable": "Jm_VaR"}}
     self.assertEqual(target, cfg)
예제 #35
0
    def test_dns_cache_mgr_requests(self):
        """

        :return:
        """
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = json.loads(open(__dir__() + "/../../tests/json/get-post.json").read())
        obj.execution = obj.engine.config['execution']
        obj.settings.merge(obj.engine.config.get("modules").get("jmeter"))
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        dns_managers = xml_tree.findall(".//DNSCacheManager")
        # 1 dns_manager
        self.assertEqual(len(dns_managers), 1)
        # check system.properies file contents
        sys_prop = open(os.path.join(obj.engine.artifacts_dir, "system.properties")).read()
        self.assertTrue("any_prop=true" in sys_prop)
        self.assertTrue("sun.net.inetaddr.ttl=0" in sys_prop)
예제 #36
0
    def test_duration_loops_bug(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config[Provisioning.PROV] = 'test'
        obj.execution = BetterDict()
        obj.execution.merge({
            "concurrency": 10,
            "ramp-up": 15,
            "hold-for": "2m",
            "scenario": {"script": __dir__() + "/../jmx/http.jmx"}
        })
        obj.prepare()

        modified_xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        tg = modified_xml_tree.find(".//ThreadGroup")
        loop_ctrl = tg.find(".//elementProp[@name='ThreadGroup.main_controller']")
        tg_loops = loop_ctrl.find(".//intProp[@name='LoopController.loops']")
        tg_forever = loop_ctrl.find(".//boolProp[@name='LoopController.continue_forever']")
        self.assertEqual(tg_loops.text, "-1")
        self.assertEqual(tg_forever.text, "false")
예제 #37
0
    def test_dns_cache_mgr_script(self):
        """

        :return:
        """
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = BetterDict()
        obj.engine.config.merge(yaml.load(open("tests/yaml/dns_mgr_script.yml").read()))
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.settings.merge(obj.engine.config.get("modules").get("jmeter"))
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        dns_managers = xml_tree.findall(".//DNSCacheManager")
        # 0 dns_managers
        self.assertEqual(len(dns_managers), 0)
        sys_prop = open(os.path.join(obj.engine.artifacts_dir, "system.properties")).read()
        self.assertTrue("any_prop=true" in sys_prop)
        self.assertFalse("sun.net.inetaddr.ttl=0" in sys_prop)
예제 #38
0
    def test_http_request_defaults(self):
        obj = JMeterExecutor()
        obj.engine = EngineEmul()
        obj.engine.config = json.loads(open("tests/json/get-post.json").read())
        obj.execution = obj.engine.config['execution']
        obj.prepare()
        xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
        default_elements = xml_tree.findall(".//ConfigTestElement[@testclass='ConfigTestElement']")
        self.assertEqual(1, len(default_elements))

        default_element = default_elements[0]
        self.assertEqual("www.somehost.com", default_element.find(".//stringProp[@name='HTTPSampler.domain']").text)
        self.assertEqual("884", default_element.find(".//stringProp[@name='HTTPSampler.port']").text)
        self.assertEqual("https", default_element.find(".//stringProp[@name='HTTPSampler.protocol']").text)
        self.assertEqual("true", default_element.find(".//boolProp[@name='HTTPSampler.image_parser']").text)
        self.assertEqual("true", default_element.find(".//boolProp[@name='HTTPSampler.concurrentDwn']").text)
        self.assertEqual("10", default_element.find(".//stringProp[@name='HTTPSampler.concurrentPool']").text)
        # all keepalives in requests are disabled
        requests = xml_tree.findall(".//HTTPSamplerProxy[@testclass='HTTPSamplerProxy']")
        for request in requests:
            self.assertEqual("false", request.find(".//boolProp[@name='HTTPSampler.use_keepalive']").text)
예제 #39
0
 def test_step_shaper(self):
     obj = JMeterExecutor()
     obj.engine = EngineEmul()
     obj.engine.config = BetterDict()
     obj.engine.config.merge({
         'execution': {
             'steps': 5,
             'concurrency': 170,
             'scenario': {
                 'script': __dir__() + '/../jmx/stepping_ramp_up.jmx'
             },
             'ramp-up': '1m',
             'distributed': ['127.0.0.1'],
             'hold-for': '2m'
         }
     })
     obj.engine.config.merge({"provisioning": "local"})
     obj.execution = obj.engine.config['execution']
     obj.execution['throughput'] = 100
     obj.prepare()
     load = obj.get_load()
     modified_xml_tree = etree.fromstring(
         open(obj.modified_jmx, "rb").read())
     timer = modified_xml_tree.findall(
         ".//kg.apc.jmeter.timers.VariableThroughputTimer")
     self.assertEqual(len(timer), 1)
     for num, step_collection in enumerate(
             timer[0].findall(".//load_profile")):
         step_start_rps = step_collection.find(".//stringProp[@name='49']")
         step_stop_rps = step_collection.find(".//stringProp[@name='1567']")
         self.assertTrue(step_start_rps == step_stop_rps == str(
             int(round(float(load.throughput) / load.steps))))
         if num + 1 == load.steps:
             self.assertEqual(
                 step_collection.find(".//stringProp[@name='53']"),
                 load.hold + load.ramp_up / load.steps)
         else:
             self.assertEqual(
                 step_collection.find(".//stringProp[@name='53']"),
                 load.ramp_up / load.steps)
예제 #40
0
 def test_step_shaper(self):
     obj = JMeterExecutor()
     obj.engine = EngineEmul()
     obj.engine.config = BetterDict()
     obj.engine.config.merge(yaml.load(open("tests/yaml/stepping_ramp_up.yml").read()))
     obj.engine.config.merge({"provisioning": "local"})
     obj.execution = obj.engine.config['execution']
     obj.execution['throughput'] = 100
     obj.prepare()
     load = obj.get_load()
     modified_xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
     timer = modified_xml_tree.findall(".//kg.apc.jmeter.timers.VariableThroughputTimer")
     self.assertEqual(len(timer), 1)
     for num, step_collection in enumerate(timer[0].findall(".//load_profile")):
         step_start_rps = step_collection.find(".//stringProp[@name='49']")
         step_stop_rps = step_collection.find(".//stringProp[@name='1567']")
         self.assertTrue(step_start_rps == step_stop_rps == str(int(round(float(load.throughput) / load.steps))))
         if num + 1 == load.steps:
             self.assertEqual(step_collection.find(".//stringProp[@name='53']"),
                              load.hold + load.ramp_up / load.steps)
         else:
             self.assertEqual(step_collection.find(".//stringProp[@name='53']"), load.ramp_up / load.steps)
예제 #41
0
 def test_step_shaper(self):
     obj = JMeterExecutor()
     obj.engine = EngineEmul()
     obj.engine.config = BetterDict()
     obj.engine.config.merge({'execution': {'steps': 5, 'concurrency': 170,
                                            'scenario': {'script': 'tests/jmx/stepping_ramp_up.jmx'},
                                            'ramp-up': '1m', 'distributed': ['127.0.0.1'], 'hold-for': '2m'}})
     obj.engine.config.merge({"provisioning": "local"})
     obj.execution = obj.engine.config['execution']
     obj.execution['throughput'] = 100
     obj.prepare()
     load = obj.get_load()
     modified_xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
     timer = modified_xml_tree.findall(".//kg.apc.jmeter.timers.VariableThroughputTimer")
     self.assertEqual(len(timer), 1)
     for num, step_collection in enumerate(timer[0].findall(".//load_profile")):
         step_start_rps = step_collection.find(".//stringProp[@name='49']")
         step_stop_rps = step_collection.find(".//stringProp[@name='1567']")
         self.assertTrue(step_start_rps == step_stop_rps == str(int(round(float(load.throughput) / load.steps))))
         if num + 1 == load.steps:
             self.assertEqual(step_collection.find(".//stringProp[@name='53']"),
                              load.hold + load.ramp_up / load.steps)
         else:
             self.assertEqual(step_collection.find(".//stringProp[@name='53']"), load.ramp_up / load.steps)
예제 #42
0
    def test_xml_format_sample_labels(self):
        # generate xml, compare hash

        obj = JUnitXMLReporter()
        obj.engine = EngineEmul()
        obj.parameters = BetterDict()

        path_from_config = tempfile.mktemp(suffix='.xml', prefix='junit-xml-sample-labels',
                                           dir=obj.engine.artifacts_dir)

        # data-source: finalstats by default
        obj.parameters.merge({"filename": path_from_config})

        obj.prepare()

        datapoint = DataPoint(0, [])
        cumul_data = datapoint[DataPoint.CUMULATIVE]

        cumul_data[""] = KPISet.from_dict({
            KPISet.AVG_CONN_TIME: 7.890211417203362e-06,
            KPISet.RESP_TIMES: Counter({
                0.0: 32160, 0.001: 24919, 0.002: 1049, 0.003: 630, 0.004: 224, 0.005: 125,
                0.006: 73, 0.007: 46, 0.008: 32, 0.009: 20, 0.011: 8, 0.01: 8, 0.017: 3,
                0.016: 3, 0.014: 3, 0.013: 3, 0.04: 2, 0.012: 2, 0.079: 1, 0.081: 1,
                0.019: 1, 0.015: 1}),
            KPISet.ERRORS: [{'msg': 'Forbidden', 'cnt': 7373, 'type': 0,
                             'urls': Counter({'http://192.168.1.1/anotherquery': 7373}),
                             KPISet.RESP_CODES: '403'}],
            KPISet.STDEV_RESP_TIME: 0.04947974228872108,
            KPISet.AVG_LATENCY: 0.0002825639815220692,
            KPISet.RESP_CODES: Counter({'304': 29656, '403': 29656, '200': 2}),
            KPISet.PERCENTILES: {'95.0': 0.001, '0.0': 0.0, '99.9': 0.008, '90.0': 0.001,
                                 '100.0': 0.081, '99.0': 0.003, '50.0': 0.0},
            KPISet.SUCCESSES: 29658,
            KPISet.SAMPLE_COUNT: 59314,
            KPISet.CONCURRENCY: 0,
            KPISet.AVG_RESP_TIME: 0.0005440536804127192,
            KPISet.FAILURES: 29656})

        cumul_data["http://192.168.1.1/somequery"] = KPISet.from_dict({
            KPISet.AVG_CONN_TIME: 9.609548856969457e-06,
            KPISet.RESP_TIMES: Counter({
                0.0: 17219, 0.001: 11246, 0.002: 543, 0.003: 341,
                0.004: 121,
                0.005: 66, 0.006: 36, 0.007: 33, 0.008: 18,
                0.009: 12, 0.011: 6,
                0.01: 5, 0.013: 2, 0.017: 2, 0.012: 2, 0.079: 1,
                0.016: 1,
                0.014: 1, 0.019: 1, 0.04: 1, 0.081: 1}),
            KPISet.ERRORS: [],
            KPISet.STDEV_RESP_TIME: 0.04073402130687656,
            KPISet.AVG_LATENCY: 1.7196034796682178e-06,
            KPISet.RESP_CODES: Counter({'304': 29656, '200': 2}),
            KPISet.PERCENTILES: {'95.0': 0.001, '0.0': 0.0,
                                 '99.9': 0.009,
                                 '90.0': 0.001,
                                 '100.0': 0.081,
                                 '99.0': 0.004,
                                 '50.0': 0.0},
            KPISet.SUCCESSES: 29658,
            KPISet.SAMPLE_COUNT: 29658,
            KPISet.CONCURRENCY: 0,
            KPISet.AVG_RESP_TIME: 0.0005164542450603551, KPISet.FAILURES: 0})

        cumul_data["http://192.168.1.1/anotherquery"] = KPISet.from_dict({
            KPISet.AVG_CONN_TIME: 6.1707580253574335e-06,
            KPISet.RESP_TIMES: Counter({0.0: 14941, 0.001: 13673, 0.002: 506,
                                        0.003: 289, 0.004: 103,
                                        0.005: 59, 0.006: 37, 0.008: 14,
                                        0.007: 13, 0.009: 8, 0.01: 3,
                                        0.011: 2, 0.016: 2, 0.014: 2,
                                        0.017: 1, 0.013: 1, 0.015: 1,
                                        0.04: 1}),
            KPISet.ERRORS: [
                {'msg': 'Forbidden', 'cnt': 7373, 'type': 0,
                 'urls': Counter({'http://192.168.1.1/anotherquery': 7373}),
                 KPISet.RESP_CODES: '403'}],
            KPISet.STDEV_RESP_TIME: 0.032465137860758844,
            KPISet.AVG_LATENCY: 0.0005634272997032645,
            KPISet.RESP_CODES: Counter({'403': 29656}),
            KPISet.PERCENTILES: {'95.0': 0.001, '0.0': 0.0,
                                 '99.9': 0.008, '90.0': 0.001,
                                 '100.0': 0.04, '99.0': 0.003,
                                 '50.0': 0.0},
            KPISet.SUCCESSES: 0,
            KPISet.SAMPLE_COUNT: 29656,
            KPISet.CONCURRENCY: 0,
            KPISet.AVG_RESP_TIME: 0.0005716549770704078,
            KPISet.FAILURES: 29656})

        cumul_data["http://192.168.100.100/somequery"] = KPISet.from_dict({
            KPISet.AVG_CONN_TIME: 9.609548856969457e-06,
            KPISet.RESP_TIMES: Counter({
                0.0: 17219, 0.001: 11246, 0.002: 543,
                0.003: 341, 0.004: 121,
                0.005: 66, 0.006: 36, 0.007: 33, 0.008: 18,
                0.009: 12, 0.011: 6,
                0.01: 5, 0.013: 2, 0.017: 2, 0.012: 2,
                0.079: 1, 0.016: 1,
                0.014: 1, 0.019: 1, 0.04: 1, 0.081: 1}),
            KPISet.ERRORS: [],
            KPISet.STDEV_RESP_TIME: 0.04073402130687656,
            KPISet.AVG_LATENCY: 1.7196034796682178e-06,
            KPISet.RESP_CODES: Counter({'304': 29656, '200': 2}),
            KPISet.PERCENTILES: {'95.0': 0.001, '0.0': 0.0,
                                 '99.9': 0.009, '90.0': 0.001,
                                 '100.0': 0.081, '99.0': 0.004,
                                 '50.0': 0.0},
            KPISet.SUCCESSES: 29658,
            KPISet.SAMPLE_COUNT: 29658,
            KPISet.CONCURRENCY: 0,
            KPISet.AVG_RESP_TIME: 0.0005164542450603551,
            KPISet.FAILURES: 0})

        obj.aggregated_second(datapoint)

        obj.post_process()

        with open(obj.report_file_path, 'rb') as fds:
            f_contents = fds.read()

        xml_tree = etree.fromstring(f_contents)
        self.assertEqual('testsuite', xml_tree.tag)
        self.assertEqual(3, len(xml_tree.getchildren()))
        self.assertEqual('testcase', xml_tree.getchildren()[0].tag)
        self.assertEqual('error', xml_tree.getchildren()[0].getchildren()[0].tag)
        self.assertEqual('error', xml_tree.getchildren()[0].getchildren()[0].tag)
        self.assertListEqual(['sample_labels', "bzt"], xml_tree.values())