How to use bzt - 10 common examples

To help you get started, we’ve selected a few bzt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Blazemeter / taurus / tests / test_jmx2yaml.py View on Github external
}, {
                'script-text': u'console.log("\u041f\u0420\u0418\u0412\u0415\u0422");\nline("2");',
                'execute': 'after', 'compile-cache': 'true', 'language': 'javascript', 'parameters': 'a b c'
            }, {
                'execute': 'after', 'compile-cache': 'true', 'language': 'javascript', 'parameters': None,
                'script-file': 'script.js'
            }, {
                'script-text': 'console.log("beanshell aka jsr223");', 'execute': 'before',
                'compile-cache': True, 'language': 'beanshell', 'parameters': None
            }, {
                'execute': 'before', 'compile-cache': 'true', 'language': 'java', 'parameters': None,
                'script-file': 'tests/resources/BlazeDemo.java'}]

            self.assertEqual(parsed_jsrs, target)

            js_script = os.path.join(get_full_path(self.obj.dst_file, step_up=1), 'script.js')
            self.assertTrue(os.path.exists(js_script))
        finally:
            os.remove(os.path.join(get_full_path(self.obj.dst_file, step_up=1), 'script.js'))
github Blazemeter / taurus / tests / modules / test_shellexec.py View on Github external
def test_long_buf(self):
        """ subprocess (tast) became blocked and blocks parent (shellexec)
        if exchange buffer (PIPE) is full because of wait() """
        file_name = temp_file()
        if is_windows():
            task = "type "
            buf_len = 2 ** 10 * 4  # 4K
        else:
            task = "tail "
            buf_len = 2 ** 10 * 64  # 64K
        task += file_name
        buf = '*' * (buf_len + 1)
        with open(file_name, "w+") as _file:
            _file.write(buf)

        self.obj.parameters.merge({"prepare": [task]})
        self.obj.prepare()
        self.obj.startup()
        self.obj.shutdown()
        out = self.log_recorder.debug_buff.getvalue()
        self.assertIn(buf, out)
github Blazemeter / taurus / tests / modules / test_pbench.py View on Github external
def test_same_address_port(self):
        config = RESOURCES_DIR + "yaml/phantom_request_same_address.yml"
        self.configure(yaml.load(open(config).read()))
        self.assertRaises(TaurusConfigError, self.obj.prepare)
github Blazemeter / taurus / tests / modules / test_Siege.py View on Github external
def test_repetition_exceptions(self):
        self.configure({"execution": {
            "concurrency": 2,
            "ramp-up": "1h",
            "scenario": {
                "requests": [
                    "http://blazedemo.com",
                    "http://ya.ru"]}}})
        self.obj.prepare()
        self.assertEqual(len(self.obj.resource_files()), 0)
        self.assertRaises(TaurusConfigError, self.obj.startup)
github Blazemeter / taurus / tests / modules / jmeter / test_JTLReader.py View on Github external
self.assertEqual(values.get('')[0].get("msg"), "message")
        self.assertEqual(values.get('')[1].get("msg"), "FOUND")
        self.assertEqual(values.get('')[2].get("msg"), "second message")
        self.assertEqual(values.get('')[3].get("msg"), "NOT FOUND")
        self.assertEqual(values.get('')[3].get("cnt"), 2)

        self.assertEqual(values.get('tc1')[0].get("msg"), "FOUND")
        self.assertEqual(values.get("tc1")[0].get("type"), KPISet.ERRTYPE_SUBSAMPLE)
        self.assertEqual(values.get('tc3')[0].get("msg"), "message")
        self.assertEqual(values.get("tc3")[0].get("type"), KPISet.ERRTYPE_ERROR)
        self.assertEqual(values.get("tc3")[1].get("type"), KPISet.ERRTYPE_ERROR)
        self.assertEqual(values.get('tc3')[1].get("msg"), "second message")
        self.assertEqual(values.get('tc4')[0].get("msg"), "NOT FOUND")
        self.assertEqual(values.get("tc4")[0].get("type"), KPISet.ERRTYPE_SUBSAMPLE)
        self.assertEqual(values.get('tc5')[0].get("msg"), "NOT FOUND")
        self.assertEqual(values.get("tc5")[0].get("type"), KPISet.ERRTYPE_SUBSAMPLE)
github Blazemeter / taurus / tests / modules / test_aggregator.py View on Github external
for point in mock.datapoints():
            self.assertNotEquals(0, point[DataPoint.CUMULATIVE][''][KPISet.CONCURRENCY])

        mock.data.append((2, "", 1, r(), r(), r(), 200, None, '', 0))
        mock.data.append((2, "", 1, r(), r(), r(), 200, None, '', 0))

        for point in mock.datapoints():
            pass

        for point in mock.datapoints(True):
            pass

        for point in mock.results:
            overall = point[DataPoint.CURRENT]['']
            self.assertTrue(len(overall[KPISet.PERCENTILES]) > 0)
github Blazemeter / taurus / tests / modules / test_FinalStatusReporter.py View on Github external
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})
        return datapoint
github Blazemeter / taurus / tests / modules / selenium / test_SeleniumExecutor.py View on Github external
def test_from_extension(self):
        self.configure(yaml.load(open(RESOURCES_DIR + "yaml/selenium_from_extension.yml").read()))
        self.obj.prepare()
        self.obj.get_widget()
        self.obj.startup()
        while not self.obj.check():
            time.sleep(self.obj.engine.check_interval)
        self.obj.shutdown()
        results = list(self.obj.runner.reader.datapoints(final_pass=True))

        self.obj.runner._tailer.close()
        self.obj.runner.reader.underlings[0].csvreader.file.close()

        self.assertEquals(1, len(results))
        self.assertFalse(results[0][DataPoint.CUMULATIVE][''][KPISet.ERRORS])  # error msg
github Blazemeter / taurus / tests / modules / test_cloudProvisioning.py View on Github external
def aggregated_second(self, data):
                for x in data[DataPoint.CURRENT].values():
                    a = x[KPISet.FAILURES] / x[KPISet.SAMPLE_COUNT]
                    obj.log.debug("TS: %s %s", data[DataPoint.TIMESTAMP], x[KPISet.SAMPLE_COUNT])
                for x in data[DataPoint.CUMULATIVE].values():
                    a = x[KPISet.FAILURES] / x[KPISet.SAMPLE_COUNT]
                    obj.log.debug("TS: %s %s", data[DataPoint.TIMESTAMP], x[KPISet.SAMPLE_COUNT])
github Blazemeter / taurus / tests / modules / test_FinalStatusReporter.py View on Github external
def __get_datapoint(self, ts=0):
        datapoint = DataPoint(ts, None)
        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,