ngrinder腳本get請求調(diào)試

1、啟動agent端口

ngrinder腳本get請求調(diào)試

創(chuàng)新互聯(lián)是一家專業(yè)的成都網(wǎng)站建設(shè)公司,我們專注成都網(wǎng)站制作、網(wǎng)站設(shè)計、網(wǎng)絡(luò)營銷、企業(yè)網(wǎng)站建設(shè),外鏈,廣告投放平臺為企業(yè)客戶提供一站式建站解決方案,能帶給客戶新的互聯(lián)網(wǎng)理念。從網(wǎng)站結(jié)構(gòu)的規(guī)劃UI設(shè)計到用戶體驗提高,創(chuàng)新互聯(lián)力求做到盡善盡美。

2、點擊腳本跳轉(zhuǎn)到腳本

ngrinder腳本get請求調(diào)試
文件加跳轉(zhuǎn)到腳本如下:


    public static GTest test
    public static HTTPRequest request
    public static NVPair[] headers = []
    public static NVPair[] params = []
    public static Cookie[] cookies = []

    @BeforeProcess
    public static void beforeProcess() {
        HTTPPluginControl.getConnectionDefaults().timeout = 6000
        test = new GTest(1, "blog.51cto.com")
        request = new HTTPRequest()
        grinder.logger.info("before process.");
    }

    @BeforeThread 
    public void beforeThread() {
        test.record(this, "test")
        grinder.statistics.delayReports=true;
        grinder.logger.info("before thread.");
    }

    @Before
    public void before() {
        request.setHeaders(headers)
        cookies.each { CookieModule.addCookie(it, HTTPPluginControl.getThreadHTTPClientContext()) }
        grinder.logger.info("before thread. init headers and cookies");
    }

    @Test
    public void test(){
        HTTPResponse result = request.GET("https://blog.51cto.com/357712148/2440849", params)

        if (result.statusCode == 301 || result.statusCode == 302) {
            grinder.logger.warn("Warning. The response may not be correct. The response code was {}.", result.statusCode); 
        } else {
            assertThat(result.statusCode, is(200));
        }
    }

3、點擊保存驗證腳本是否可運行

ngrinder腳本get請求調(diào)試

提示:

ngrinder腳本get請求調(diào)試

查看日志:

ngrinder腳本get請求調(diào)試

文章標題:ngrinder腳本get請求調(diào)試
新聞來源:http://muchs.cn/article44/joheee.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、網(wǎng)站設(shè)計公司云服務(wù)器、網(wǎng)站制作、網(wǎng)站策劃、搜索引擎優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)