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

How to manually test front-end and switch between server responses,

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

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

我来解释一下: 我正在为 webapp 开发一个前端。 我想手动测试应用程序(在没有测试运行器的情况下使用我的鼠标和键盘)并且没有后端服务器。 我想在许多场景中看到该应用程序。,当用户登录,注销时....

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

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

你可以在这里看到:

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\"}"
}
]
}