zoukankan      html  css  js  c++  java
  • login.py

    2021-02-22 - 请用pytest框架编写以下案例的测试用例、
    并执行测试用例,生成allure报告。
    截止时间:02月24日19:00
    如题 。。
    作业的案例是一个登陆操作。
    用一个函数来表示登陆功能。
    大家要做的事情就是:针对这个功能设计测试,并执行并生成报告 。
    
    登陆功能见附件。
    '''
    # 功能逻辑
    def login_check(username=None, password=None):
        """ 登录校验的函数
        :param username: 账号
        :param password: 密码
        :return: dict type
        """
        if username != None and password != None:
            if username == 'python37' and password == 'lemonban':
                return {"code": 0, "msg": "登录成功"}
            else:
                return {"code": 1, "msg": "账号或密码不正确"}
        else:
            return {"code": 1, "msg": "所有的参数不能为空"}
    
    
    
    
    
    
    
    """
    1、账号密码正确 
    入参:账号python27 密码lemonban 
    预期结果:{"code": 0, "msg": "登录成功"} 
    实际结果: 
    
    2、账号正确,密码错误 
    入参:账号python27 密码lemonban11 
    预期结果:{"code": 1, "msg": "账号或密码不正确"} 
    实际结果: 
    
    3、账号错误,密码正确, 
    入参:账号python25 密码lemonban 
    预期结果:{"code": 1, "msg": "账号或密码不正确"} 
    实际结果:
    
    4、账号为空 
    入参:账号为空 密码lemonban11 
    预期结果:{"code": 1, "msg": "所以的参数不能为空"} 
    实际结果: 
    
    5、密码为空、 
    入参:账号Python6 密码为空 
    预期结果:{"code": 1, "msg": "所以的参数不能为空"} 
    实际结果 
    """
  • 相关阅读:
    Deploy Django in Windows
    Django开发环境配置
    springmvc源码解读
    分布式事务中常见的三种解决方案
    分布式锁总结
    JAVA代码优化
    Mysql(mysql总结)
    树(数据结构二)
    集合(Java总结一)
    centos7.7下docker与k8s安装(DevOps三)
  • 原文地址:https://www.cnblogs.com/zhang-ping1205/p/14448447.html
Copyright © 2011-2022 走看看