最新公告
  • 新注册用户请前往个人中心绑定邮箱以便接收相关凭证邮件!!!点击前往个人中心
  • 从零到企业级SSM电商项目验收测试(四)购物车模块测试

    1.购物车List列表

    /cart/list.do

    http://localhost:8080/cart/list.do

    [v_error]注意点:
    1、需要先登录,所有的密码都是123
    2、NEED_LOGIN(10, “NEED_LOGIN”),//需要登录的错误编码
    3、价格的单位是元,保留小数后2位[/v_error]

    [v_act]request[/v_act]

    无参数,需要登录状态
    

    [v_act]response[/v_act]
    success

    {
        "status": 0,
        "data": {
            "cartProductVoList": [
                {
                    "id": 1,
                    "userId": 13,
                    "productId": 1,
                    "quantity": 1,
                    "productName": "iphone7",
                    "productSubtitle": "双十一促销",
                    "productMainImage": "mainimage.jpg",
                    "productPrice": 7199.22,
                    "productStatus": 1,
                    "productTotalPrice": 7199.22,
                    "productStock": 86,
                    "productChecked": 1,
                    "limitQuantity": "LIMIT_NUM_SUCCESS"
                },
                {
                    "id": 2,
                    "userId": 13,
                    "productId": 2,
                    "quantity": 1,
                    "productName": "oppo R8",
                    "productSubtitle": "oppo促销进行中",
                    "productMainImage": "mainimage.jpg",
                    "productPrice": 2999.11,
                    "productStatus": 1,
                    "productTotalPrice": 2999.11,
                    "productStock": 86,
                    "productChecked": 1,
                    "limitQuantity": "LIMIT_NUM_SUCCESS"
                }
            ],
            "allChecked": true,
            "cartTotalPrice": 10198.33
        }
    }
    


    fail

    {
        "status": 10,
        "msg": "用户未登录,请登录"
    }
    

    2.购物车添加商品

    /cart/add.do

    http://localhost:8080/cart/add.do?productId=1&count=10

    [v_error]请注意这个字段,超过数量会返回这样的标识”limitQuantity”

    失败的:LIMIT_NUM_FAIL 成功的:LIMIT_NUM_SUCCESS[/v_error]

    [v_act]request[/v_act]

    productId,count
    

    [v_act]response[/v_act]
    success

    {
        "status": 0,
        "data": {
            "cartProductVoList": [
                {
                    "id": 1,
                    "userId": 13,
                    "productId": 1,
                    "quantity": 12,
                    "productName": "iphone7",
                    "productSubtitle": "双十一促销",
                    "productMainImage": "mainimage.jpg",
                    "productPrice": 7199.22,
                    "productStatus": 1,
                    "productTotalPrice": 86390.64,
                    "productStock": 86,
                    "productChecked": 1,
                    "limitQuantity": "LIMIT_NUM_SUCCESS"
                },
                {
                    "id": 2,
                    "userId": 13,
                    "productId": 2,
                    "quantity": 1,
                    "productName": "oppo R8",
                    "productSubtitle": "oppo促销进行中",
                    "productMainImage": "mainimage.jpg",
                    "productPrice": 2999.11,
                    "productStatus": 1,
                    "productTotalPrice": 2999.11,
                    "productStock": 86,
                    "productChecked": 1,
                    "limitQuantity": "LIMIT_NUM_SUCCESS"
                }
            ],
            "allChecked": true,
            "cartTotalPrice": 89389.75
        }
    }
    

    fail

    {
        "status": 10,
        "msg": "用户未登录,请登录"
    }
    

    3.更新购物车某个产品数量

    /cart/update.do

    http://localhost:8080/cart/update.do?productId=1&count=2

    [v_act]request[/v_act]

    productId,count
    

    [v_act]response[/v_act]

    响应同2

    success

    {
        "status": 0,
        "data": {
            "cartProductVoList": [
                {
                    "id": 1,
                    "userId": 13,
                    "productId": 1,
                    "quantity": 12,
                    "productName": "iphone7",
                    "productSubtitle": "双十一促销",
                    "productMainImage": "mainimage.jpg",
                    "productPrice": 7199.22,
                    "productStatus": 1,
                    "productTotalPrice": 86390.64,
                    "productStock": 86,
                    "productChecked": 1,
                    "limitQuantity": "LIMIT_NUM_SUCCESS"
                },
                {
                    "id": 2,
                    "userId": 13,
                    "productId": 2,
                    "quantity": 1,
                    "productName": "oppo R8",
                    "productSubtitle": "oppo促销进行中",
                    "productMainImage": "mainimage.jpg",
                    "productPrice": 2999.11,
                    "productStatus": 1,
                    "productTotalPrice": 2999.11,
                    "productStock": 86,
                    "productChecked": 1,
                    "limitQuantity": "LIMIT_NUM_SUCCESS"
                }
            ],
            "allChecked": true,
            "cartTotalPrice": 89389.75
        }
    }
    


    fail

    {
        "status": 10,
        "msg": "用户未登录,请登录"
    }
    

    4.移除购物车某个产品

    /cart/delete_product.do

    http://localhost:8080/cart/delete_product.do?productIds=1,3

    [v_act]request[/v_act]

    productIds
    

    [v_act]response[/v_act]
    success

    {
        "status": 0,
        "data": {
            "cartProductVoList": [
                {
                    "id": 2,
                    "userId": 13,
                    "productId": 2,
                    "quantity": 1,
                    "productName": "oppo R8",
                    "productSubtitle": "oppo促销进行中",
                    "productMainImage": "mainimage.jpg",
                    "productPrice": 2999.11,
                    "productStatus": 1,
                    "productTotalPrice": 2999.11,
                    "productStock": 86,
                    "productChecked": 1,
                    "limitQuantity": "LIMIT_NUM_SUCCESS"
                }
            ],
            "allChecked": true,
            "cartTotalPrice": 2999.11
        }
    }
    


    fail

    {
        "status": 10,
        "msg": "用户未登录,请登录"
    }
    

    5.购物车选中某个商品

    /cart/select.do

    http://localhost:8080/cart/select.do?productId=1

    [v_act]request[/v_act]

    productId
    

    [v_act]response[/v_act]
    success

    {
        "status": 0,
        "data": {
            "cartProductVoList": [
                {
                    "id": 2,
                    "userId": 13,
                    "productId": 2,
                    "quantity": 1,
                    "productName": "oppo R8",
                    "productSubtitle": "oppo促销进行中",
                    "productMainImage": "mainimage.jpg",
                    "productPrice": 2999.11,
                    "productStatus": 1,
                    "productTotalPrice": 2999.11,
                    "productStock": 86,
                    "productChecked": 1,
                    "limitQuantity": "LIMIT_NUM_SUCCESS"
                }
            ],
            "allChecked": true,
            "cartTotalPrice": 2999.11
        }
    }
    


    fail

    {
        "status": 10,
        "msg": "用户未登录,请登录"
    }
    

    6.购物车取消选中某个商品

    /cart/un_select.do

    http://localhost:8080/cart/un_select.do?productId=2

    [v_error]注意返回值中的cartTotalPrice,如果反选之后总价的变化[/v_error]

    [v_act]request[/v_act]

    productId
    

    [v_act]response[/v_act]
    success

    {
        "status": 0,
        "data": {
            "cartProductVoList": [
                {
                    "id": 2,
                    "userId": 13,
                    "productId": 2,
                    "quantity": 1,
                    "productName": "oppo R8",
                    "productSubtitle": "oppo促销进行中",
                    "productMainImage": "mainimage.jpg",
                    "productPrice": 2999.11,
                    "productStatus": 1,
                    "productTotalPrice": 2999.11,
                    "productStock": 86,
                    "productChecked": 0,
                    "limitQuantity": "LIMIT_NUM_SUCCESS"
                }
            ],
            "allChecked": true,
            "cartTotalPrice": 0
        }
    }
    


    fail

    {
        "status": 10,
        "msg": "用户未登录,请登录"
    }
    

    7.查询在购物车里的产品数量

    /cart/get_cart_product_count.do

    http://localhost:8080/cart/get_cart_product_count.do

    [v_error]未登录返回0[/v_error]

    [v_act]request[/v_act]

    [v_act]response[/v_act]

    success

    {
        "status": 0,
        "data": 0
        
    }
    


    fail

    {
        "status": 10,
        "msg": "出现异常"
    }
    

    8.购物车全选

    /cart/select_all.do

    http://localhost:8080/cart/select_all.do

    [v_error]注意返回值中的cartTotalPrice的变化[/v_error]

    [v_act]request[/v_act]

    [v_act]response[/v_act]
    success

    {
        "status": 0,
        "data": {
            "cartProductVoList": [
                {
                    "id": 2,
                    "userId": 13,
                    "productId": 2,
                    "quantity": 1,
                    "productName": "oppo R8",
                    "productSubtitle": "oppo促销进行中",
                    "productMainImage": "mainimage.jpg",
                    "productPrice": 2999.11,
                    "productStatus": 1,
                    "productTotalPrice": 2999.11,
                    "productStock": 86,
                    "productChecked": 0,
                    "limitQuantity": "LIMIT_NUM_SUCCESS"
                }
            ],
            "allChecked": true,
            "cartTotalPrice": 2999.11
        }
    }
    


    fail

    {
        "status": 10,
        "msg": "用户未登录,请登录"
    }
    

    9.购物车取消全选

    /cart/un_select_all.do

    http://localhost:8080/cart/un_select_all.do

    [v_error]注意返回值中的cartTotalPrice总价的变化[/v_error]

    [v_act]request[/v_act]

    [v_act]response[/v_act]
    success

    {
        "status": 0,
        "data": {
            "cartProductVoList": [
                {
                    "id": 2,
                    "userId": 13,
                    "productId": 2,
                    "quantity": 1,
                    "productName": "oppo R8",
                    "productSubtitle": "oppo促销进行中",
                    "productMainImage": "mainimage.jpg",
                    "productPrice": 2999.11,
                    "productStatus": 1,
                    "productTotalPrice": 2999.11,
                    "productStock": 86,
                    "productChecked": 0,
                    "limitQuantity": "LIMIT_NUM_SUCCESS"
                }
            ],
            "allChecked": true,
            "cartTotalPrice": 0
        }
    }
    

    fail

    {
        "status": 10,
        "msg": "用户未登录,请登录"
    }
    
    本站所有文章均由网友分享,仅用于参考学习用,请勿直接转载,如有侵权,请联系网站客服删除相关文章。若由于商用引起版权纠纷,一切责任均由使用者承担
    极客文库 » 从零到企业级SSM电商项目验收测试(四)购物车模块测试

    常见问题FAQ

    如果资源链接失效了怎么办?
    本站用户分享的所有资源都有自动备份机制,如果资源链接失效,请联系本站客服QQ:2580505920更新资源地址。
    如果用户分享的资源与描述不符怎么办?
    可以联系客服QQ:2580505920,如果要求合理可以安排退款或者退赞助积分。
    如何分享个人资源获取赞助积分或其他奖励?
    本站用户可以分享自己的资源,但是必须保证资源没有侵权行为。点击个人中心,根据操作填写并上传即可。资源所获收益完全归属上传者,每周可申请提现一次。
    如果您发现了本资源有侵权行为怎么办?
    及时联系客服QQ:2580505920,核实予以删除。

    参与讨论

    • 211会员总数(位)
    • 3737资源总数(个)
    • 0本周发布(个)
    • 0 今日发布(个)
    • 919稳定运行(天)

    欢迎加入「极客文库」,成为原创作者从这里开始!

    立即加入 了解更多
    成为赞助用户享有更多特权立即升级