从零到企业级SSM电商项目验收测试(三)商品管理模块测试

1.产品list

/manage/product/list.do

http://localhost:8080/manage/product/list.do

[v_act]request[/v_act]

pageNum(default=1)
pageSize(default=10)

[v_act]response[/v_act]
success

{
    "status": 0,
    "data": {
        "pageNum": 1,
        "pageSize": 10,
        "size": 2,
        "orderBy": null,
        "startRow": 1,
        "endRow": 2,
        "total": 2,
        "pages": 1,
        "list": [
            {
                "id": 1,
                "categoryId": 3,
                "name": "iphone7",
                "subtitle": "双十一促销",
                "mainImage": "mainimage.jpg",
                "status":1,
                "price": 7199.22
            },
            {
                "id": 2,
                "categoryId": 2,
                "name": "oppo R8",
                "subtitle": "oppo促销进行中",
                "mainImage": "mainimage.jpg",
                "status":1,
                "price": 2999.11
            }
        ],
        "firstPage": 1,
        "prePage": 0,
        "nextPage": 0,
        "lastPage": 1,
        "isFirstPage": true,
        "isLastPage": true,
        "hasPreviousPage": false,
        "hasNextPage": false,
        "navigatePages": 8,
        "navigatepageNums": [
            1
        ]
    }
}

fail

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

2.产品搜索

/manage/product/search.do
[v_act]request[/v_act]

productName
productId
pageNum(default=1)
pageSize(default=10)

[v_act]response[/v_act]
success

{
    "status": 0,
    "data": {
        "pageNum": 1,
        "pageSize": 10,
        "size": 1,
        "orderBy": null,
        "startRow": 1,
        "endRow": 1,
        "total": 1,
        "pages": 1,
        "list": [
            {
                "id": 1,
                "categoryId": 3,
                "name": "iphone7",
                "subtitle": "双十一促销",
                "mainImage": "mainimage.jpg",
                "price": 7199.22
            }
        ],
        "firstPage": 1,
        "prePage": 0,
        "nextPage": 0,
        "lastPage": 1,
        "isFirstPage": true,
        "isLastPage": true,
        "hasPreviousPage": false,
        "hasNextPage": false,
        "navigatePages": 8,
        "navigatepageNums": [
            1
        ]
    }
}

fail

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

3.图片上传

/manage/product/upload.do
[v_act]request[/v_act]

[v_act]response[/v_act]
success

{
    "status": 0,
    "data": {
        "uri": "e6604558-c0ff-41b9-b6e1-30787a1e3412.jpg",
        "url": "http://img.happymmall.com/e6604558-c0ff-41b9-b6e1-30787a1e3412.jpg"
    }
}

fail

status!=0的时候

4.富文本上传图片

/manage/product/richtext_img_upload.do
[v_act]request[/v_act]

[v_act]response[/v_act]

success

{
    "file_path": "http://img.verynavi.com/5fb239f2-0007-40c1-b8e6-0dc11b22779c.jpg",
    "msg": "上传成功",
    "success": true
}

fail

{
    "success": false,
    "msg": "error message",
    "file_path": "[real file path]"
}

5.产品详情

/manage/product/detail.do

[v_act]request[/v_act]

productId

[v_act]response[/v_act]
success

{
    "status": 0,
    "data": {
        "id": 2,
        "categoryId": 2,
        "parentCategoryId":1,
        "name": "oppo R8",
        "subtitle": "oppo促销进行中",
        "imageHost": "http://img.verynavi.com/",
        "mainImage": "mainimage.jpg",
        "subImages": "[\"mmall/aa.jpg\",\"mmall/bb.jpg\",\"mmall/cc.jpg\",\"mmall/dd.jpg\",\"mmall/ee.jpg\"]",
        "detail": "richtext",
        "price": 2999.11,
        "stock": 71,
        "status": 1,
        "createTime": "2016-11-20 14:21:53",
        "updateTime": "2016-11-20 14:21:53"
    }
}

fail

{
    "status": 1,
    "msg": "没有权限"
}

6.产品上下架

/manage/product/set_sale_status.do
[v_act]request[/v_act]

productId
status

[v_act]response[/v_act]
success

{
    "status": 0,
    "data": "修改产品状态成功"
}

fail

{
    "status": 1,
    "data": "修改产品状态失败"
}

7.新增OR更新产品

/manage/product/save.do
[v_act]request[/v_act]

categoryId=1&name=三星洗衣机&subtitle=三星大促销&mainImage=sss.jpg&subImages=test.jpg&detail=detailtext&price=1000&stock=100&status=1&id=3

[v_act]response[/v_act]
success

{
    "status": 0,
    "data": "更新产品成功"
}

或


{
    "status": 0,
    "data": "新增产品成功"
}

fail

{
    "status": 1,
    "data": "更新产品失败"
}

8.产品搜索及动态排序List(前台)

/product/list.do
[v_act]request[/v_act]

categoryId
keyword
pageNum(default=1)
pageSize(default=10)
orderBy(default=""):排序参数:例如price_desc,price_asc

[v_act]response[/v_act]
success

{
    "status": 0,
    "data": {
        "pageNum": 1,
        "pageSize": 10,
        "size": 2,
        "orderBy": null,
        "startRow": 1,
        "endRow": 2,
        "total": 2,
        "pages": 1,
        "list": [
            {
                "id": 1,
                "categoryId": 3,
                "name": "iphone7",
                "subtitle": "双十一促销",
                "mainImage": "mainimage.jpg",
                "status":1,
                "price": 7199.22
            },
            {
                "id": 2,
                "categoryId": 2,
                "name": "oppo R8",
                "subtitle": "oppo促销进行中",
                "mainImage": "mainimage.jpg",
                "status":1,
                "price": 2999.11
            }
        ],
        "firstPage": 1,
        "prePage": 0,
        "nextPage": 0,
        "lastPage": 1,
        "isFirstPage": true,
        "isLastPage": true,
        "hasPreviousPage": false,
        "hasNextPage": false,
        "navigatePages": 8,
        "navigatepageNums": [
            1
        ]
    }
}


fail

{
    "status": 1,
    "msg": "参数错误"
}

9.产品detail

/product/detail.do
[v_act]request[/v_act]

productId

[v_act]response[/v_act]
success

{
  "status": 0,
  "data": {
    "id": 2,
    "categoryId": 2,
    "name": "oppo R8",
    "subtitle": "oppo促销进行中",
    "mainImage": "mainimage.jpg",
    "subImages": "[\"mmall/aa.jpg\",\"mmall/bb.jpg\",\"mmall/cc.jpg\",\"mmall/dd.jpg\",\"mmall/ee.jpg\"]",
    "detail": "richtext",
    "price": 2999.11,
    "stock": 71,
    "status": 1,
    "createTime": "2016-11-20 14:21:53",
    "updateTime": "2016-11-20 14:21:53"
  }
}

fail

{
    "status": 1,
    "msg": "该商品已下架或删除"
}

本站所有文章均由网友分享,仅用于参考学习用,请勿直接转载,如有侵权,请联系网站客服删除相关文章。若由于商用引起版权纠纷,一切责任均由使用者承担
极客文库 » 从零到企业级SSM电商项目验收测试(三)商品管理模块测试

Leave a Reply

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

立即加入 了解更多