如何手动测试前端并在服务器响应之间切换,

时间:2015-07-23 22:26:01

标签: javascript qunit

我正在寻找一种工具,帮助创建用于在服务器模型测试响应之间进行选择的UI。

(或其他有助于创建前端的解决方案)

我会解释: 我正在开发webapp的前端。 我想手动测试应用程序(使用我的鼠标和键盘,没有测试跑步者)并且没有后端服务器。 我想在许多场景中看到该应用。当用户登录时,请注销....

所以我希望能够轻松切换服务器模拟响应

mockup of who i think it needs to be

1 个答案:

答案 0 :(得分:0)

我没有找到答案,所以我开发了它!

您可以在此处查看:

http://aminag.github.io/javascript-xhr-mock-chooser/tests.host.html

设置文件:

http://aminag.github.io/javascript-xhr-mock-chooser/xhr-mock-settings.json

<强> Github上

https://github.com/AminaG/javascript-xhr-mock-chooser/

设置文件示例:

{
"default_show":"true",
"data":
[
{
    "method":"get",
    "url":"/",
    "response":"GREAT"
},
{
    "name":"test 2",
    "method":"post",
    "url":"/a",
    "response":[
        {
            "response":"ok"
        },
        {
            "name":"Signed Off",
            "response":"false"
        }
    ]
},
{
    "name":"test 4 /c",
    "url":"/c",
    "response":{
        "status":404
    }
},
{
    "name":"test /b ",
    "url":"/b",
    "response":{
        "content-type":"abc",
        "body":"ok"
    }
},
{
    "name":"test response multi object /d",
    "url":"/d",
    "response":[
        {
            "name":"Sigen in",
            "response":{
                    "content-type":"abc",
                    "body":"ok"
            }
        },
        {
            "name":"Signed Off",
            "response":"false"
        }
    ]
},
{
    "url":"/api/getJson",
    "response":"{\"json_working\":\"yes\"}"
}
]
}

enter image description here