• 极客专栏正式上线!欢迎访问 https://www.jikewenku.com/topic.html
  • 极客专栏正式上线!欢迎访问 https://www.jikewenku.com/topic.html

从零到企业级SSM电商项目验收测试(四)购物车模块测试

项目实战 Geekerstar 11个月前 (07-09) 753次浏览 已收录 0个评论 扫描二维码
文章目录[隐藏]

1.购物车List列表

/cart/list.do

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

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

response

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

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

失败的:LIMIT_NUM_FAIL 成功的:LIMIT_NUM_SUCCESS

request
productId,count

response

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

request
productId,count
response

响应同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

request
productIds

response

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

request
productId

response

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

注意返回值中的cartTotalPrice,如果反选之后总价的变化
request
productId

response

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

未登录返回0
request
response

success

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


fail

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

8.购物车全选

/cart/select_all.do

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

注意返回值中的cartTotalPrice的变化
request

response

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

注意返回值中的cartTotalPrice总价的变化
request

response

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": "用户未登录,请登录"
}

丨极客文库, 版权所有丨如未注明 , 均为原创丨
本网站采用知识共享署名-非商业性使用-相同方式共享 3.0 中国大陆许可协议进行授权
转载请注明原文链接:从零到企业级SSM电商项目验收测试(四)购物车模块测试
喜欢 (0)
[247507792@qq.com]
分享 (0)
Geekerstar
关于作者:
本站技术支持

您必须 登录 才能发表评论!

  • 精品技术教程
  • 编程资源分享
  • 问答交流社区
  • 极客文库知识库

客服QQ


QQ:2248886839


工作时间:09:00-23:00