Пример #1
0
 def test_embedded_resources_fail_child_assert(self):
     obj = JTLErrorsReader(__dir__() + "/../data/resource-errors-child-assert.jtl", logging.getLogger(''))
     obj.read_file(True)
     values = obj.get_data(sys.maxsize)
     self.assertEqual(values.get('')[0].get("msg"), "subsample assertion error")
     self.assertEqual(values.get('')[1].get("msg"), "NOT FOUND")
     self.assertEqual(values.get('HTTP Request')[0].get("msg"), "subsample assertion error")
     self.assertEqual(values.get('HTTP Request')[1].get("msg"), "NOT FOUND")
Пример #2
0
 def test_embedded_resources_no_fail(self):
     obj = JTLErrorsReader(__dir__() + "/../data/resource-errors-no-fail.jtl", logging.getLogger(''))
     obj.read_file(True)
     values = obj.get_data(sys.maxsize)
     self.assertEqual(values.get('')[0].get("msg"), "success_true_with_failed_embedded_resources")
     self.assertEqual(values.get('')[1].get("msg"), "failed_resource_message")
     self.assertEqual(values.get('HTTP Request')[0].get("msg"), "success_true_with_failed_embedded_resources")
     self.assertEqual(values.get('HTTP Request')[1].get("msg"), "failed_resource_message")
Пример #3
0
 def test_embedded_resources_main_sample_fail_assert(self):
     obj = JTLErrorsReader(
         __dir__() + "/../data/resource-errors-main-assert.jtl",
         logging.getLogger(''))
     obj.read_file()
     values = obj.get_data(sys.maxsize)
     self.assertEqual(values.get('')[0].get("msg"), "Test failed")
     self.assertEqual(
         values.get('HTTP Request')[0].get("msg"), "Test failed")
Пример #4
0
 def test_embedded_resources_no_fail(self):
     obj = JTLErrorsReader(
         __dir__() + "/../data/resource-errors-no-fail.jtl",
         logging.getLogger(''))
     obj.read_file()
     values = obj.get_data(sys.maxsize)
     self.assertEqual(len(values.get('HTTP Request')), 1)
     self.assertEqual(
         values.get('HTTP Request')[0].get("msg"),
         "failed_resource_message")
Пример #5
0
 def test_embedded_resources_fail_child_assert(self):
     obj = JTLErrorsReader(
         __dir__() + "/../data/resource-errors-child-assert.jtl",
         logging.getLogger(''))
     obj.read_file()
     values = obj.get_data(sys.maxsize)
     self.assertEqual(
         values.get('')[0].get("msg"), "subsample assertion error")
     self.assertEqual(values.get('')[1].get("msg"), "NOT FOUND")
     self.assertEqual(
         values.get('HTTP Request')[0].get("msg"),
         "subsample assertion error")
     self.assertEqual(values.get('HTTP Request')[1].get("msg"), "NOT FOUND")
Пример #6
0
    def test_resource_tc(self):
        obj = JTLErrorsReader(__dir__() + "/../data/resource_tc.jtl", logging.getLogger(''))
        obj.read_file(True)
        values = obj.get_data(sys.maxsize)
        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('')[4].get("msg"), "Failed")

        self.assertEqual(values.get('tc1')[0].get("msg"), "FOUND")
        self.assertEqual(values.get('tc3')[0].get("msg"), "message")
        self.assertEqual(values.get('tc3')[1].get("msg"), "second message")
        self.assertEqual(values.get('tc4')[0].get("msg"), "NOT FOUND")
        self.assertEqual(values.get('tc5')[0].get("msg"), "Failed")
Пример #7
0
class TestJTLErrorsReader(BZTestCase):
    def setUp(self):
        super(TestJTLErrorsReader, self).setUp()
        self.obj = None

    def configure(self, jtl_file):
        self.obj = JTLErrorsReader(jtl_file, logging.getLogger(''))

    def tearDown(self):
        close_reader_file(self.obj)
        super(TestJTLErrorsReader, self).tearDown()

    def test_nonstandard_errors_unicode(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/nonstandard-unicode.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertNotEquals(
            values[''][0]['msg'].find(
                u'Cannot find function error in object Файфокс'), -1)
        self.assertNotEquals(
            values[''][1]['msg'].find(
                'Cannot find function error in object FirefoxDriver'), -1)

    def test_standard_errors_format(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/standard-errors.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(3, len(values))
Пример #8
0
class TestJTLErrorsReader(BZTestCase):
    def setUp(self):
        super(TestJTLErrorsReader, self).setUp()
        self.obj = None

    def configure(self, jtl_file):
        self.obj = JTLErrorsReader(jtl_file, logging.getLogger(''))

    def tearDown(self):
        close_reader_file(self.obj)
        super(TestJTLErrorsReader, self).tearDown()

    def test_nonstandard_errors_unicode(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/nonstandard-unicode.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertNotEquals(
            values[''][0]['msg'].find(
                u'Cannot find function error in object Файфокс'), -1)
        self.assertNotEquals(
            values[''][1]['msg'].find(
                'Cannot find function error in object FirefoxDriver'), -1)

    def test_standard_errors_format(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/standard-errors.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(3, len(values))

    @unittest.skipUnless(sys.platform == "darwin" and sys.version_info >=
                         (3, 0), "MacOS- and Python3-only")
    def test_macos_unicode_parsing_is_not_supported(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/standard-errors.jtl")
        self.obj.read_file(
            final_pass=True
        )  # shouldn't fail with "ParserError: Unicode parsing is not supported"
Пример #9
0
class TestJTLErrorsReader(BZTestCase):
    def setUp(self):
        super(TestJTLErrorsReader, self).setUp()
        self.obj = None

    def configure(self, jtl_file):
        self.obj = JTLErrorsReader(jtl_file, logging.getLogger(''))

    def tearDown(self):
        close_reader_file(self.obj)
        super(TestJTLErrorsReader, self).tearDown()

    def test_nonstandard_errors_unicode(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/nonstandard-unicode.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertNotEquals(values[''][0]['msg'].find(u'Cannot find function error in object Файфокс'), -1)
        self.assertNotEquals(values[''][1]['msg'].find('Cannot find function error in object FirefoxDriver'), -1)

    def test_standard_errors_format(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/standard-errors.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(3, len(values))
Пример #10
0
 def test_standard_errors_format(self):
     obj = JTLErrorsReader(RESOURCES_DIR + "/jmeter/jtl/standard-errors.jtl", logging.getLogger(''))
     obj.read_file()
     values = obj.get_data(sys.maxsize)
     self.assertEquals(3, len(values))
Пример #11
0
 def test_embedded_resources_main_sample_fail_assert(self):
     obj = JTLErrorsReader(__dir__() + "/../data/resource-errors-main-assert.jtl", logging.getLogger(''))
     obj.read_file(True)
     values = obj.get_data(sys.maxsize)
     self.assertEqual(values.get('')[0].get("msg"), "Test failed")
     self.assertEqual(values.get('HTTP Request')[0].get("msg"), "Test failed")
Пример #12
0
 def test_standard_errors_format(self):
     obj = JTLErrorsReader(__dir__() + "/../data/standard-errors.jtl", logging.getLogger(''))
     obj.read_file(True)
     values = obj.get_data(sys.maxsize)
     self.assertEquals(3, len(values))
Пример #13
0
 def test_nonstandard_errors_format(self):
     obj = JTLErrorsReader(__dir__() + "/../data/nonstandard-errors.jtl", logging.getLogger(''))
     obj.read_file()
     values = obj.get_data(sys.maxsize)
     self.assertNotEquals(values[''][0]['msg'].find('Cannot find function error in object FirefoxDriver'), -1)
Пример #14
0
 def configure(self, jtl_file):
     self.obj = JTLErrorsReader(jtl_file, logging.getLogger(''))
Пример #15
0
 def configure(self, jtl_file):
     self.obj = JTLErrorsReader(jtl_file, logging.getLogger(''))
Пример #16
0
 def configure(self, jtl_file):
     self.obj = JTLErrorsReader(jtl_file, ROOT_LOGGER)
Пример #17
0
class TestJTLErrorsReader(BZTestCase):
    def setUp(self):
        super(TestJTLErrorsReader, self).setUp()
        self.obj = None

    def configure(self, jtl_file):
        self.obj = JTLErrorsReader(jtl_file, ROOT_LOGGER)

    def tearDown(self):
        close_reader_file(self.obj)
        super(TestJTLErrorsReader, self).tearDown()

    def test_embedded_resources_no_fail(self):
        self.configure(RESOURCES_DIR +
                       "/jmeter/jtl/resource-errors-no-fail.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(len(values.get('HTTP Request')), 1)
        self.assertEqual(
            values.get('HTTP Request')[0].get("msg"),
            "failed_resource_message")

    def test_embedded_resources_main_sample_fail_assert(self):
        self.configure(RESOURCES_DIR +
                       "/jmeter/jtl/resource-errors-main-assert.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(values.get('')[0].get("msg"), "Test failed")
        self.assertEqual(
            values.get('HTTP Request')[0].get("msg"), "Test failed")

    def test_embedded_resources_fail_child_no_assert(self):
        self.configure(RESOURCES_DIR +
                       "/jmeter/jtl/resource-errors-child-no-assert.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(values.get('')[0].get("msg"), "NOT FOUND")
        self.assertEqual(values.get('HTTP Request')[0].get("msg"), "NOT FOUND")

    def test_embedded_resources_fail_child_assert(self):
        self.configure(RESOURCES_DIR +
                       "/jmeter/jtl/resource-errors-child-assert.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(1, len(values.get("")))
        self.assertEqual(values.get('')[0].get("msg"), "NOT FOUND")
        self.assertEqual(values.get('HTTP Request')[0].get("msg"), "NOT FOUND")

    def test_resource_tc(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/resource_tc.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(4, len(values.get("")))
        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)

    def test_nonstandard_errors_unicode(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/nonstandard-unicode.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertNotEquals(
            values[''][0]['msg'].find(
                u'Cannot find function error in object Файфокс'), -1)
        self.assertNotEquals(
            values[''][1]['msg'].find(
                'Cannot find function error in object FirefoxDriver'), -1)

    def test_standard_errors_format(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/standard-errors.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(3, len(values))
        self.assertEquals(KPISet.ERRTYPE_ERROR, values[''][0]['type'])
        self.assertEqual(KPISet.ERRTYPE_ASSERT, values[""][1]["type"])
        self.assertIn("text expected to contain", values[""][1]["msg"])
        self.assertIn("Assert", values[""][1]["tag"])

    def test_embedded_errors(self):
        self.configure(RESOURCES_DIR +
                       "/jmeter/jtl/resource-error-embedded.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(2, len(values))
        self.assertEquals(KPISet.ERRTYPE_SUBSAMPLE, values[''][0]['type'])
        self.assertEquals('404', values[''][0]['rc'])

    def test_error_parsing(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-parsing.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(2, len(values))
        self.assertEquals(KPISet.ERRTYPE_ERROR, values[''][0]['type'])
        self.assertEquals('200', values[''][0]['rc'])

    @unittest.skipUnless(sys.platform == "darwin" and sys.version_info >=
                         (3, 0), "MacOS- and Python3-only")
    def test_macos_unicode_parsing_is_not_supported(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/standard-errors.jtl")
        self.obj.read_file(
            final_pass=True
        )  # shouldn't fail with "ParserError: Unicode parsing is not supported"
Пример #18
0
class TestJTLErrorsReader(BZTestCase):
    def setUp(self):
        super(TestJTLErrorsReader, self).setUp()
        self.obj = None

    def configure(self, jtl_file, err_msg_sep=None):
        self.obj = JTLErrorsReader(jtl_file, ROOT_LOGGER, err_msg_separator=err_msg_sep)

    def tearDown(self):
        close_reader_file(self.obj)
        super(TestJTLErrorsReader, self).tearDown()

    def test_embedded_resources_no_fail(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/resource-errors-no-fail.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(len(values.get('HTTP Request')), 1)
        self.assertEqual(values.get('HTTP Request')[0].get("msg"), "failed_resource_message")

    def test_embedded_resources_main_sample_fail_assert(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/resource-errors-main-assert.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(values.get('')[0].get("msg"), "Test failed")
        self.assertEqual(values.get('HTTP Request')[0].get("msg"), "Test failed")

    def test_embedded_resources_fail_child_no_assert(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/resource-errors-child-no-assert.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(values.get('')[0].get("msg"), "NOT FOUND")
        self.assertEqual(values.get('HTTP Request')[0].get("msg"), "NOT FOUND")

    def test_embedded_resources_fail_child_assert(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/resource-errors-child-assert.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(1, len(values.get("")))
        self.assertEqual(values.get('')[0].get("msg"), "NOT FOUND")
        self.assertEqual(values.get('HTTP Request')[0].get("msg"), "NOT FOUND")

    def test_bug1(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-bug1.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(9, len(values.get("")))
        self.assertEqual(values.get('')[0].get("msg"), "Non HTTP response message: Connection reset")

    def test_short_err_message(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-mix.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(values.get('')[0].get("msg"), "Not Found")

    def test_full_err_message(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-mix.jtl", err_msg_sep=" *OMG!* ")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(values.get('')[0].get("msg"), "Test failed: code expected to contain /777/ *OMG!* Not Found")

    def test_puzzle_jtl(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-puzzle.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(values.get('')[0].get("msg"), "Test failed: text expected not to contain /understanding/")

    def test_resource_tc(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/resource_tc.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(4, len(values.get("")))
        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)

    def test_nonstandard_errors_unicode(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/nonstandard-unicode.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertNotEquals(values[''][0]['msg'].find(u'Cannot find function error in object Файфокс'), -1)
        self.assertNotEquals(values[''][1]['msg'].find('Cannot find function error in object FirefoxDriver'), -1)

    def test_standard_errors_format(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/standard-errors.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(3, len(values))
        self.assertEquals(KPISet.ERRTYPE_ERROR, values[''][0]['type'])
        self.assertEqual(KPISet.ERRTYPE_ASSERT, values[""][1]["type"])
        self.assertIn("text expected to contain", values[""][1]["msg"])
        self.assertIn("Assert", values[""][1]["tag"])

    def test_embedded_errors(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/resource-error-embedded.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(2, len(values))
        self.assertEquals(KPISet.ERRTYPE_SUBSAMPLE, values[''][0]['type'])
        self.assertEquals('404', values[''][0]['rc'])

    def test_error_parsing(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-parsing.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(2, len(values))
        self.assertEquals(KPISet.ERRTYPE_ERROR, values[''][0]['type'])
        self.assertEquals('200', values[''][0]['rc'])

    @unittest.skipUnless(sys.platform == "darwin" and sys.version_info >= (3, 0), "MacOS- and Python3-only")
    def test_macos_unicode_parsing_is_not_supported(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/standard-errors.jtl")
        self.obj.read_file(final_pass=True)  # shouldn't fail with "ParserError: Unicode parsing is not supported"
Пример #19
0
 def test_nonstandard_errors_format(self):
     obj = JTLErrorsReader(RESOURCES_DIR + "/jmeter/jtl/nonstandard-errors.jtl", logging.getLogger(''))
     obj.read_file()
     values = obj.get_data(sys.maxsize)
     self.assertNotEquals(values[''][0]['msg'].find('Cannot find function error in object FirefoxDriver'), -1)
Пример #20
0
class TestJTLErrorsReader(BZTestCase):
    def setUp(self):
        super(TestJTLErrorsReader, self).setUp()
        self.obj = None

    def configure(self, jtl_file, err_msg_sep=None):
        self.obj = JTLErrorsReader(jtl_file,
                                   ROOT_LOGGER,
                                   err_msg_separator=err_msg_sep)

    def tearDown(self):
        close_reader_file(self.obj)
        super(TestJTLErrorsReader, self).tearDown()

    def test_smart_aggregation_assert(self):
        self.configure(RESOURCES_DIR +
                       "/jmeter/jtl/smart-aggregation/errors.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        # todo: process rule according to assertion

    def test_embedded_resources_no_fail(self):
        self.configure(RESOURCES_DIR +
                       "/jmeter/jtl/resource-errors-no-fail.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(len(values.get('HTTP Request')), 1)
        self.assertEqual(
            values.get('HTTP Request')[0].get("msg"),
            "failed_resource_message")

    def test_embedded_resources_main_sample_fail_assert(self):
        self.configure(RESOURCES_DIR +
                       "/jmeter/jtl/resource-errors-main-assert.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(values.get('')[0].get("msg"), "Test failed")
        self.assertEqual(
            values.get('HTTP Request')[0].get("msg"), "Test failed")

    def test_embedded_resources_fail_child_no_assert(self):
        self.configure(RESOURCES_DIR +
                       "/jmeter/jtl/resource-errors-child-no-assert.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(values.get('')[0].get("msg"), "NOT FOUND")
        self.assertEqual(values.get('HTTP Request')[0].get("msg"), "NOT FOUND")

    def test_embedded_resources_fail_child_assert(self):
        self.configure(RESOURCES_DIR +
                       "/jmeter/jtl/resource-errors-child-assert.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(1, len(values.get("")))
        self.assertEqual(values.get('')[0].get("msg"), "NOT FOUND")
        self.assertEqual(values.get('HTTP Request')[0].get("msg"), "NOT FOUND")

    def test_bug1(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-bug1.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(9, len(values.get("")))
        self.assertEqual(
            values.get('')[0].get("msg"),
            "Non HTTP response message: Connection reset")

    def test_assertion_ts(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-bug1.jtl")
        self.obj.read_file()
        first_ts = int(list(self.obj.buffer.keys())[0])
        values = self.obj.get_data(first_ts)
        self.assertTrue(values)

    def test_short_err_message(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-mix.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(values.get('')[0].get("msg"), "Not Found")

    def test_full_err_message(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-mix.jtl",
                       err_msg_sep=" *OMG!* ")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(
            values.get('')[0].get("msg"),
            "Test failed: code expected to contain /777/ *OMG!* Not Found")

    def test_puzzle_jtl(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-puzzle.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(
            values.get('')[0].get("msg"),
            "Test failed: text expected not to contain /understanding/")

    def test_resource_tc(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/resource_tc.jtl")
        self.obj.read_file()
        values = self.obj.get_data(sys.maxsize)
        self.assertEqual(4, len(values.get("")))
        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)

    def test_nonstandard_errors_unicode(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/nonstandard-unicode.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertNotEquals(
            values[''][0]['msg'].find(
                u'Cannot find function error in object Файфокс'), -1)
        self.assertNotEquals(
            values[''][1]['msg'].find(
                'Cannot find function error in object FirefoxDriver'), -1)

    def test_standard_errors_format(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/standard-errors.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(3, len(values))
        self.assertEquals(KPISet.ERRTYPE_ERROR, values[''][0]['type'])
        self.assertEqual(KPISet.ERRTYPE_ASSERT, values[""][1]["type"])
        self.assertIn("text expected to contain", values[""][1]["msg"])
        self.assertIn("Assert", values[""][1]["tag"])

    def test_embedded_errors(self):
        self.configure(RESOURCES_DIR +
                       "/jmeter/jtl/resource-error-embedded.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(2, len(values))
        self.assertEquals(KPISet.ERRTYPE_SUBSAMPLE, values[''][0]['type'])
        self.assertEquals('404', values[''][0]['rc'])

    def test_error_parsing(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/error-parsing.jtl")
        self.obj.read_file(final_pass=True)
        values = self.obj.get_data(sys.maxsize)
        self.assertEquals(2, len(values))
        self.assertEquals(KPISet.ERRTYPE_ERROR, values[''][0]['type'])
        self.assertEquals('200', values[''][0]['rc'])

    @unittest.skipUnless(sys.platform == "darwin", "MacOS-only")
    def test_macos_unicode_parsing_is_not_supported(self):
        self.configure(RESOURCES_DIR + "/jmeter/jtl/standard-errors.jtl")
        self.obj.read_file(
            final_pass=True
        )  # shouldn't fail with "ParserError: Unicode parsing is not supported"
Пример #21
0
 def configure(self, jtl_file, err_msg_sep=None):
     self.obj = JTLErrorsReader(jtl_file, ROOT_LOGGER, err_msg_separator=err_msg_sep)
Пример #22
0
 def configure(self, jtl_file, err_msg_sep=None):
     self.obj = JTLErrorsReader(jtl_file,
                                ROOT_LOGGER,
                                err_msg_separator=err_msg_sep)
Пример #23
0
 def configure(self, jtl_file):
     self.obj = JTLErrorsReader(jtl_file, ROOT_LOGGER)