Exemplo n.º 1
0
    def __init__(self, dir, test_type="smoketest"):
        """Class to log errors"""
        self.test_type = test_type
        self.log = None
        self.doc = None
        self.root = ET.Element("tests")
        self.root.append(Comment('Auto Generated in TestLog.py'))
        self.num_tests_run = 0
        self.time = time.localtime()
        self.all_tests_start = time.strftime('%d %B %Y %H:%M:%S', self.time)
        self.url_friendly_start = time.strftime('%d_%B_%Y', self.time)
        self.dir = dir
        self.ipAddress = Utils.format_ip_address(sys.argv[1])

        path = os.path.join(GlobalFuncs.path())

        el = ET.SubElement(self.root, 'allTestsStart')
        el.set('allTestsStart', self.all_tests_start)
        el.set("runNumber", path.split(os.sep)[-1])
        el.set('ipAddress', self.ipAddress)

        self.screenshots = []
Exemplo n.º 2
0
    for date in Utils.get_dirs(logs_dir):
        for run in Utils.get_dirs(os.path.join(Utils.log_dir(), 'logs', date)):
            print('date', date, 'list',
                  os.listdir(os.path.join(Utils.log_dir(), 'logs', date)))
            run_dates_file.write(date + '/' + run + '\n')

else:
    run_dates_file = open(run_dates_path, "a+")
    run_dates_file.write(sub_path + '\n')

run_dates_file.close()

for i in range(3, len(sys.argv)):
    # path = os.path.join(path_to_dir, Utils.format_ip_address(sys.argv[i]))
    path = os.path.normcase(
        os.path.join("logs", sub_path, Utils.format_ip_address(sys.argv[i])))
    field = ET.SubElement(root, "ipAddress", location=path).text = sys.argv[i]

tree = ET.ElementTree(root)
tree.write(os.path.join(path_to_dir, 'ip-addresses.xml'))

argStart = 1
browser = 'chrome'

for i in range(1, len(sys.argv)):
    if (sys.argv[i] == '-browser'):
        argStart = i + 2
        browser = sys.argv[i + 1]

step = 3
for i in range(argStart, len(sys.argv), step):