Пример #1
0
 def assert_dict_equal(self, d1, d2, msg=None):
     try:
         self.assertDictEqual(d1, d2, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file("%s\\screenshots\\%s__%s.png" % (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(d2)
Пример #2
0
 def assert_not_is_instance(self, obj, cls, msg=None):
     try:
         self.assertNotIsInstance(obj, cls, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file("%s\\screenshots\\%s__%s.png" % (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log("Please change this successful message")
Пример #3
0
 def assert_not_in(self, member, container, msg=None):
     try:
         self.assertNotIn(member, container, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file("%s\\screenshots\\%s__%s.png" % (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(member)
Пример #4
0
 def assert_multi_line_equal(self, first, second, msg=None):
     try:
         self.assertMultiLineEqual(first, second, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file("%s\\screenshots\\%s__%s.png" % (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(second)
Пример #5
0
 def assert_tuple_equal(self, tuple1, expr, msg=None):
     try:
         self.assertTupleEqual(tuple1, expr, msg)
     except AssertionError as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file("%s\\screenshots\\%s__%s.png" % (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(expr)
Пример #6
0
 def assert_not_equal(self, first, second, msg = None):
     try:
         self.assertNotEqual(first, second)
     except AssertionError as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             ## Screenshot function causes HtmlUnit execution error, let it go...
             Conf.DRIVER.get_screenshot_as_file("%s\\screenshots\\%s__%s.png" % (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(first)
Пример #7
0
 def assert_not_in(self, member, container, msg=None):
     try:
         self.assertNotIn(member, container, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file(
                 "%s\\screenshots\\%s__%s.png" %
                 (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(member)
Пример #8
0
 def assert_list_equal(self, list1, expr, msg=None):
     try:
         self.assertListEqual(list1, expr, msg)
     except AssertionError as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file(
                 "%s\\screenshots\\%s__%s.png" %
                 (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(expr)
Пример #9
0
 def assert_multi_line_equal(self, first, second, msg=None):
     try:
         self.assertMultiLineEqual(first, second, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file(
                 "%s\\screenshots\\%s__%s.png" %
                 (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(second)
Пример #10
0
 def assert_dict_equal(self, d1, d2, msg=None):
     try:
         self.assertDictEqual(d1, d2, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file(
                 "%s\\screenshots\\%s__%s.png" %
                 (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(d2)
Пример #11
0
 def assert_not_equal(self, first, second, msg=None):
     try:
         self.assertNotEqual(first, second)
     except AssertionError as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             ## Screenshot function causes HtmlUnit execution error, let it go...
             Conf.DRIVER.get_screenshot_as_file(
                 "%s\\screenshots\\%s__%s.png" %
                 (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(first)
Пример #12
0
 def assert_not_is_instance(self, obj, cls, msg=None):
     try:
         self.assertNotIsInstance(obj, cls, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file(
                 "%s\\screenshots\\%s__%s.png" %
                 (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(
             "Please change this successful message")
Пример #13
0
 def assert_dict_contains_subset(self, expected, actual, msg=None):
     '''
     d1 = {'b': 1, 'e': 2, 'f': 3}
     d2 = {'b': 1, 'e': 2, 'f': 3, 't':4}
     Assert().assert_dict_contains_subset(d2, d1)
     '''
     try:
         self.assertDictContainsSubset(expected, actual, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file("%s\\screenshots\\%s__%s.png" % (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(expected)
Пример #14
0
 def assert_set_equal(self, set1, expr, msg=None):
     '''
     s1 = set([1,2,3,4])
     s2 = set([1,2,3,4,5])
     Assert().assert_set_equal(s1, s2)
     '''
     try:
         self.assertSetEqual(set1, expr, msg)
     except AssertionError as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file("%s\\screenshots\\%s__%s.png" % (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(expr)
Пример #15
0
 def assert_items_equal(self, expected_seq, actual_seq, msg=None):
     '''
     Asserts that each element has the same count in both sequences.
     Example:
         - [0, 1, 1] and [1, 0, 1] compare equal.
         - [0, 0, 1] and [0, 1] compare unequal.
     '''
     try:
         self.assertItemsEqual(expected_seq, actual_seq, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file("%s\\screenshots\\%s__%s.png" % (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(expected_seq)
Пример #16
0
 def assert_set_equal(self, set1, expr, msg=None):
     '''
     s1 = set([1,2,3,4])
     s2 = set([1,2,3,4,5])
     Assert().assert_set_equal(s1, s2)
     '''
     try:
         self.assertSetEqual(set1, expr, msg)
     except AssertionError as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file(
                 "%s\\screenshots\\%s__%s.png" %
                 (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(expr)
Пример #17
0
 def assert_dict_contains_subset(self, expected, actual, msg=None):
     '''
     d1 = {'b': 1, 'e': 2, 'f': 3}
     d2 = {'b': 1, 'e': 2, 'f': 3, 't':4}
     Assert().assert_dict_contains_subset(d2, d1)
     '''
     try:
         self.assertDictContainsSubset(expected, actual, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file(
                 "%s\\screenshots\\%s__%s.png" %
                 (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(expected)
Пример #18
0
 def assert_items_equal(self, expected_seq, actual_seq, msg=None):
     '''
     Asserts that each element has the same count in both sequences.
     Example:
         - [0, 1, 1] and [1, 0, 1] compare equal.
         - [0, 0, 1] and [0, 1] compare unequal.
     '''
     try:
         self.assertItemsEqual(expected_seq, actual_seq, msg)
     except Exception as e:
         if Conf.BROWSER.upper() != "HTMLUNIT":
             Conf.DRIVER.get_screenshot_as_file(
                 "%s\\screenshots\\%s__%s.png" %
                 (Conf.RESULT_PATH, Conf.CASE_NAME, stamp_datetime_co()))
         Log.write_assert_fail_log(str(e))
     else:
         Log.write_assert_success_log(expected_seq)