Beispiel #1
0
def check_StrNotFind(comment,S,findStr):
    checkStr(S,comment)
    result = S.find(findStr)
    if result==-1:
        log.check_normal("Result: PASS!")
        report.addResult_normal("PASS!")
    else:
        log.check_normal("Result: Fail!")
        report.addResult_normal("Fail!")
Beispiel #2
0
def isEqual_raiseError(actual,expect):
    if actual == expect:
        log.check_normal("Result: PASS!")
        report.addResult_normal("PASS!")
    else:
        log.check_normal("Result: Fail!")
        report.addResult_normal("Fail!")
        # Error ScreenShot
        PIC_DIR = config.PIC_DIR
        PIC_NAME = "Error_" + common.stamp_datetime2() + ".png"    # ScreenShot naming rules
        PIC_ABS = os.path.join(PIC_DIR,PIC_NAME)
        driver.get_screenshot_as_file(PIC_ABS)
        log.assert_screen(PIC_ABS)
        # raise Error
        raise autoTestError("The isEqual Check is not OK!")
Beispiel #3
0
def isEqual(actual,expect):
    if actual == expect:
        log.check_normal("Result: PASS!")
        report.addResult_normal("PASS!")
        return ["PASS","actual==expect"]
    else:
        log.check_normal("Result: Fail!")
        log.check_normal(u"Actual: {0}".format(actual))  
        log.check_normal(u"Expect: {0}".format(expect))
        report.addResult_normal("Fail!")
        report.addResult_normal(u"Actual: {0}".format(actual))
        report.addResult_normal(u"Expect: {0}".format(expect))
        return ["Fail",u"Actual: {0}\nExpect: {1}".format(actual,expect)]
Beispiel #4
0
def checkElementAttribute(actual_xpath,attributeName,attributeValue,comment=""):
    checkElement(comment,actual_xpath) 
    actual = element(actual_xpath).getAttribute(attributeName)
    msg = "checkElement:[{0}]({1})'s attribute:'{2}' ".format(actual_xpath,comment,attributeName)
    log.check_normal(msg)
    isEqual(actual,attributeValue)
Beispiel #5
0
def checkStr(S,comment=""):
    info = "checkStr({0})".format(comment)
    log.check_normal(info)
    report.addCheck_normal(info)
Beispiel #6
0
def checkElement(xpath,comment=""):
    log.check_normal("checkElement: [{0}]\t{1}".format(xpath,comment))
    report.addCheck_normal(xpath)