Пример #1
0
 def __init__(self):
     self.log = Logger('main').logger()
     config = Config(main_cfg_path)
     config.cfg_load()
     port = config.cfg.get('Arduino', 'port_name')
     baudrate = config.cfg.get('Arduino', 'baudrate')
     self.project = config.cfg.get('Project', 'name')
     self.tmp_data = config.cfg.get('Data', 'tmp')
     self.led1 = config.cfg.get('Data', 'led1')
     self.led2 = config.cfg.get('Data', 'led2')
     self.sound = config.cfg.get('Data', 'sound')
     self.data_backup = config.cfg.get('Log', 'data_backup')
     self.ser = SerialHelper()
     port_name = config.cfg.get('Arduino', 'port_name')
     port = self.ser.serial_port(port_name)
     if port != '':
         self.ser.port = port
         self.ser.baudrate = baudrate
         self.ser.start()
         if not self.ser.alive:
             self.log.error('Cannot open port {}!'.format(port))
             sys.exit()
     else:
         self.log.error('Cannot find port {}!'.format(port_name))
         sys.exit()
     # here must add sleep >= 2, will be cannot receive if not
     time.sleep(2)
Пример #2
0
 def __init__(self):
     self.log = Logger("main").logger()
     config = Config(main_cfg_path)
     config.cfg_load()
     self.port_name = config.cfg.get('Relay', 'port_name')
     self.port = None
     self.ser = None
Пример #3
0
 def __init__(self):
     self.log = Logger("main").logger()
     self.ard = Arduino()
     self.process = DataProcess()
     self.r = Relay()
     self.keyword = ParseCSV('../testfile/testcase/{}_keyword.csv'.format(
         self.ard.project))
     config = Config('../config/{}.ini'.format(self.ard.project))
     config.cfg_load()
     self.led_num = config.cfg.getint('config', 'led')
     self.power_button = config.cfg.get('config', 'power_button')
     m_cfg = Config(main_cfg_path)
     m_cfg.cfg_load()
     self.led1_data = m_cfg.cfg.get('Data', 'led1')
     self.sound_data = m_cfg.cfg.get('Data', 'sound')
     if not self.r.init_relay():
         self.log.error('Something is wrong with your relay!')
         sys.exit()
Пример #4
0
import os
import datetime
from common.Config import Config
from runner.testrunner import TestRunner

main_cfg_path = '../config/main.ini'


def make_dir(path):
    if not os.path.exists(path):
        os.makedirs(path)


config = Config(main_cfg_path)
config.cfg_load()
prj_name = config.cfg.get('Project', 'name')
report_path = config.cfg.get('Result', 'path')
testlist = config.cfg.get('TestCase', 'list')

make_dir(report_path)
reprot_name = '{}/{}_test_report_{}.html'.format(
    report_path, prj_name,
    datetime.datetime.now().strftime('%m%d%H%M%S'))
title = '{} Automation Test Report'.format(prj_name)
description = 'Test Execution Details:'

TR = TestRunner(reprot_name, title, description, testlist)
TR.run()
'''
TC = TestCase()
case_path = r'..\testfile\testcase\{}_test_case.csv'.format(prj_name)