代码控如何实现配置fiddler

很多小哥哥总觉得测试点点点很low,总想码代码。那么fiddler除了一些手动设置外,还可以进行丰富的代码编写,用以完成任务。

打开fiddler,工具栏选择Rules->Customize Rules

没用过的可能有点陌生,实际上和junit很类似

给出一段示例:修改fiddler捕获js脚本文件的颜色(FiddlerScript属于fiddler的高级编程了)

static function OnBeforeRequest(oSession: Session) {
        // Sample Rule: Color ASPX requests in RED
        // if (oSession.uriContains(".aspx")) {    oSession["ui-color"] = "red";    }

        // Sample Rule: Flag POSTs to fiddler2.com in italics
        // if (oSession.HostnameIs("www.fiddler2.com") && oSession.HTTPMethodIs("POST")) {    oSession["ui-italic"] = "yup";    }

        // Sample Rule: Break requests for URLs containing "/sandbox/"
        // if (oSession.uriContains("/sandbox/")) {
        //     oSession.oFlags["x-breakrequest"] = "yup";    // Existence of the x-breakrequest flag creates a breakpoint; the "yup" value is unimportant.
        // }
        if (oSession.url.IndexOf(".js")>-1){
            oSession["ui-color"] = "orange";
        }
}

实际运行效果

小哥哥们,个性、便捷、丰富的测试工具期待你的使用。

梦想还是要有的,万一实现了呢!
原文地址:https://www.cnblogs.com/jianfeijiang/p/9361287.html