Beispiel #1
0
def T_04_reset_M(product):
    u'''复位测试-单板上电后返回数据,系统自动判断是否正确'''
    sc = __askForPlateDeviceCom()
    autoCloseAsynMessage(
        u"操作提示(提示框会自动关闭)", u"请按下夹具正面的按钮,以复位被测设备",
        lambda: sc.assertSynComm(request='TestReset',
                                 response='PowerOnSuccess'))
    time.sleep(0.5)
Beispiel #2
0
def T_12_displayDirKey_M(product):
    u'''显示方向控制键测试-屏幕显示倒转,检查是否通过'''
    sc = __askForPlateDeviceCom()
    sc.assertSynComm(request='CloseLcdDisp', response='CloseLcdDispOK')
    autoCloseAsynMessage(
        u"操作提示(提示框会自动关闭)", u"请按动屏幕倒置键",
        lambda: sc.assertSynComm(request='TestDirection',
                                 response='TestDirectionOK'))
    time.sleep(1)
    sc.assertSynComm(request='ReadButtonStatus', response='ButtonisRelease')
def T_02_sensiSwitchLocationVerify_A(product):
    u'''灵敏度开关位置判断-进行测试需要确认灵敏度开关在L档'''
    sc = __askForPlateDeviceCom()
    r = sc.assertAndGetNumberParam(request='TestSensiSwitch',
                                   response='TestSensiSwitch')
    if r != 0:
        autoCloseAsynMessage(
            u"操作提示(提示框会自动关闭)", u"请将灵敏度开关拨至另一侧",
            lambda: sc.assertAndGetNumberParam(
                request='TestSensiSwitch', response='TestSensiSwitch') == 0,
            TestItemFailException(failWeight=10, message=u'灵敏度开关测试不通过'))
Beispiel #4
0
def __carveTest(carvingCode, product):
    '''镭雕测试项'''
    __getLaserCaving().toCarveCode(carvingCode)
    try:
        autoCloseAsynMessage(
            u"操作提示(提示框会自动关闭)", u"当前镭雕号:%s,请踩下踏板进行镭雕" % carvingCode,
            lambda: __getLaserCaving().carved(),
            TestItemFailException(failWeight=10, message=u'镭雕机未响应'))
    except TestItemFailException, e:
        __getLaserCaving().clearCarveCode()
        raise e
def T_05_laserCarve_M(product):
    u'''镭雕卡面编号-自动镭雕卡面顺序编号'''
    carvingCode = SESSION["nowVariableCarve"]
    __getLaserCaving().toCarveCode(carvingCode)
    try:
        autoCloseAsynMessage(
            u"操作提示(提示框会自动关闭)", u"当前镭雕号:%s,请踩下踏板进行镭雕" % carvingCode,
            lambda: __getLaserCaving().carved(),
            TestItemFailException(failWeight=10, message=u'镭雕机未响应'))
    except TestItemFailException, e:
        __getLaserCaving().clearCarveCode()
        raise e
Beispiel #6
0
def _T_04_carving_A(product):
    u"卡面镭雕-将CPC ID镭雕到卡面"
    carvingCode = product.getTestingProductIdCode()
    __getLaserCaving().toCarveCode(carvingCode)
    try:
        autoCloseAsynMessage(
            u"操作提示(提示框会自动关闭)", u"当前镭雕号:%s,请踩下踏板进行镭雕" % carvingCode,
            lambda: __getLaserCaving().carved(),
            TestItemFailException(failWeight=10, message=u'镭雕机未响应'))
    except TestItemFailException, e:
        __getLaserCaving().clearCarveCode()
        raise e
Beispiel #7
0
def T_05_laserCarve_M(product):
    u'''镭雕卡面编号-TID号镭雕到卡面'''
    carvingCode = product.getTestingProductIdCode(
    )[PARAM["carvingTidStart"]:PARAM["carvingTidEnd"]]
    __getLaserCaving().toCarveCode(carvingCode)
    try:
        autoCloseAsynMessage(
            u"操作提示(提示框会自动关闭)", u"当前镭雕号:%s,请踩下踏板进行镭雕" % carvingCode,
            lambda: __getLaserCaving().carved(),
            TestItemFailException(failWeight=10, message=u'镭雕机未响应'))
    except TestItemFailException, e:
        __getLaserCaving().clearCarveCode()
        raise e
def _checkSingltonAndGetEpc():
    '''检查天线下正在检测的标签是一个'''
    reader = __getReader()
    ir = reader.inventory()
    if len(ir) == 0:
        autoCloseAsynMessage(u"操作提示(提示框会自动关闭)", u"没有发现标签,请放一个标签",
                             lambda: len(reader.inventory()) == 1)
    elif len(ir) > 1:
        autoCloseAsynMessage(u"操作提示(提示框会自动关闭)", u"天线下多于1个标签,请拿走多余的标签",
                             lambda: len(reader.inventory()) == 1)
    if len(reader.nowEpc) != 1:
        raise AbortTestException(message=u"天线下标签不是1个,测试终止")
    epc = reader.nowEpc[0]
    return epc
Beispiel #9
0
def __downloadFromServer(filename):
    '''从FTP上下载文件'''
    downloading = True

    def download():
        try:
            ftp = FTP()
            ftp.connect(PARAM["defaultServerIp"], PARAM["centerFtpPort"])
            ftp.login(PARAM["centerFtpUsername"], PARAM["centerFtpPassword"])
            f = open("fromftp.txt", 'w')  # 打开要保存文件
            filename = 'RETR %s' % filename  # 保存FTP文件
            ftp.retrbinary(filename, f.write)  # 保存FTP上的文件
            f.close()
            downloading = False
        finally:
            pass

    thread.start_new_thread(download, ())
    autoCloseAsynMessage(u"版本下载",
                         u"从中心服务下载版本:" + filename,
                         lambda: not downloading,
                         timeout=10)
Beispiel #10
0
def T_13_testSensiSwitch_M(product):
    u'''灵敏度条件开关测试-测试灵敏度调节开关拨动并确保其出厂在L位置'''
    sc = __askForPlateDeviceCom()

    r = sc.assertAndGetNumberParam(request='TestSensiSwitch',
                                   response='TestSensiSwitch')
    failException = TestItemFailException(failWeight=10, message=u'灵敏度开关测试不通过')
    if r == 0:
        autoCloseAsynMessage(
            u"操作提示(提示框会自动关闭)", u"请将灵敏度开关拨至另一侧",
            lambda: sc.assertAndGetNumberParam(
                request='TestSensiSwitch', response='TestSensiSwitch') == 1,
            failException)
        autoCloseAsynMessage(
            u"操作提示(提示框会自动关闭)", u"测试成功,请将灵敏度开关拨回原来的位置",
            lambda: sc.assertAndGetNumberParam(
                request='TestSensiSwitch', response='TestSensiSwitch') == 0,
            failException)
    else:
        autoCloseAsynMessage(
            u"操作提示(提示框会自动关闭)", u"请将灵敏度开关拨至另一侧",
            lambda: sc.assertAndGetNumberParam(
                request='TestSensiSwitch', response='TestSensiSwitch') == 0,
            failException)