Exemplo n.º 1
0
def step_warning(message):
    screenshot_name = "Warning__%s__%s__%s.png" % (
        common.stamp_datetime_coherent(), env.threadlocal.CASE_NAME,
        env.threadlocal.TESTING_BROWSER)

    write_log(
        os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)),
        "------------ Warning [%s] -------------------\n" %
        common.stamp_datetime())

    write_log(
        os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)),
        "%s    Warning: %s, Check ScreenShot [%s]\n" %
        (common.stamp_datetime(), message, screenshot_name))

    write_log(
        os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)),
        "------------ Warning [%s] --------------------------------------------\n"
        % common.stamp_datetime())

    try:
        save_screen_shot(screenshot_name)
    except:
        step_normal(str(sys.exc_info()))

    env.threadlocal.CASE_WARNINGS = env.threadlocal.CASE_WARNINGS + 1
Exemplo n.º 2
0
def step_fail(message):

    screenshot_name = "Fail__%s__%s__%s.png" % (common.stamp_datetime_coherent(
    ), env.threadlocal.CASE_NAME, env.threadlocal.TESTING_BROWSER)

    write_log(
        os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)),
        "------------ Fail [%s] -------------------\n" %
        common.stamp_datetime())

    write_log(
        os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)),
        "%s    Fail: %s, Check ScreenShot [%s]\n" %
        (common.stamp_datetime(), message, screenshot_name))

    write_log(
        os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)),
        "------------ Fail [%s] --------------------------------------------\n"
        % common.stamp_datetime())

    try:
        save_screen_shot(screenshot_name)
    except:
        step_normal(str(sys.exc_info()))

    env.HTMLREPORT_SCREENSHOT_NAME = screenshot_name
    env.threadlocal.CASE_PASS = False
    env.EXIT_STATUS = -1

    raise AssertionError(message)
Exemplo n.º 3
0
def step_warning(message):
    screenshot_name = "Warning__%s__%s__%s.png" % (common.stamp_datetime_coherent(), env.threadlocal.CASE_NAME, env.threadlocal.TESTING_BROWSER)
    
    write_log(os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)), 
              "------------ Warning [%s] -------------------\n"%common.stamp_datetime())
    
    write_log(os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)), 
              "%s    Warning: %s, Check ScreenShot [%s]\n" %(common.stamp_datetime(), message, screenshot_name))
    
    write_log(os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)), 
              "------------ Warning [%s] --------------------------------------------\n"%common.stamp_datetime())
    
    try:
        save_screen_shot(screenshot_name)
    except:
        step_normal(str(sys.exc_info()))
    
    env.threadlocal.CASE_WARNINGS = env.threadlocal.CASE_WARNINGS + 1
Exemplo n.º 4
0
def handle_error():
    if env.threadlocal.CASE_PASS == False:
        return
    
    
    if sys.exc_info()[0] != None:
        step_normal(common.exception_error())
        
        screenshot_name = "Fail__%s__%s__%s.png" % (common.stamp_datetime_coherent(), env.threadlocal.CASE_NAME, env.threadlocal.TESTING_BROWSER)
        
        try:
            save_screen_shot(screenshot_name)
        except:
            step_warning(str(sys.exc_info()))
        
        step_normal("Current step screen short [%s]" % (screenshot_name))
        
        env.HTMLREPORT_SCREENSHOT_NAME = screenshot_name
        
        env.threadlocal.CASE_PASS = False
        env.EXIT_STATUS = -1
Exemplo n.º 5
0
def handle_error():
    if env.threadlocal.CASE_PASS == False:
        return
    
    
    if sys.exc_info()[0] != None:
        step_normal(common.exception_error())
        
        screenshot_name = "Fail__%s__%s__%s.png" % (common.stamp_datetime_coherent(), env.threadlocal.CASE_NAME, env.threadlocal.TESTING_BROWSER)
        
        try:
            save_screen_shot(screenshot_name)
        except:
            step_warning(str(sys.exc_info()))
        
        step_normal("Current step screen short [%s]" % (screenshot_name))
        
        env.HTMLREPORT_SCREENSHOT_NAME = screenshot_name
        
        env.threadlocal.CASE_PASS = False
        env.EXIT_STATUS = -1
Exemplo n.º 6
0
def step_fail(message):
    
    screenshot_name = "Fail__%s__%s__%s.png" % (common.stamp_datetime_coherent(), env.threadlocal.CASE_NAME, env.threadlocal.TESTING_BROWSER)
    
    write_log(os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)),  
              "------------ Fail [%s] -------------------\n"%common.stamp_datetime())
    
    write_log(os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)), 
              "%s    Fail: %s, Check ScreenShot [%s]\n" %(common.stamp_datetime(), message, screenshot_name))
    
    write_log(os.path.join("testcase", "%s.log" % (env.threadlocal.CASE_NAME)), 
              "------------ Fail [%s] --------------------------------------------\n"%common.stamp_datetime())
    
    try:
        save_screen_shot(screenshot_name)
    except:
        step_normal(str(sys.exc_info()))
    
    env.HTMLREPORT_SCREENSHOT_NAME = screenshot_name
    env.threadlocal.CASE_PASS = False
    env.EXIT_STATUS = -1
    
    raise AssertionError(message)