Administrator
|
request1 = test1.wrap(HTTPRequest(url="https:/xx.xx.xx.xx"))
# Make any method call on request1 increase TPS test1.record(request1) 이 부분을 다음과 같이 바꿔보세요 request1 = HTTPRequest(url="https:/xx.xx.xx.xx") # Make any method call on request1 increase TPS test1.record(request1) 삼성 갤럭시 스마트폰에서 보냈습니다. -------- 원본 이메일 -------- 보낸 사람: "Jake Kim [via ngrinder]" <[hidden email]> 날짜: 2015/11/20 오후 3:02 (GMT+09:00) 받은 사람: junoyoon <[hidden email]> 제목: json 데이터 post에서 exception 에러 json 데이터를 post로 넘기는데 exception 에러가 나고있습니다. 간단한 스크립트인것 같은데 원인을 찾지 못하고 있습니다. 혹시 어느 부분이 잘못된 것인지 도움을 얻고자 합니다. # -*- coding:utf-8 -*- # A simple example using the HTTP plugin that shows the retrieval of a # single page via HTTP. # # This script is automatically generated by ngrinder. # # @author admin from net.grinder.script.Grinder import grinder from net.grinder.script import Test from net.grinder.plugin.http import HTTPRequest from net.grinder.plugin.http import HTTPPluginControl from HTTPClient import NVPair from java.lang import Exception from java.lang import System from org.json import JSONObject control = HTTPPluginControl.getConnectionDefaults() # if you don't want that HTTPRequest follows the redirection, please modify the following option 0. # control.followRedirects = 1 # if you want to increase the timeout, please modify the following option. control.timeout = 6000 test1 = Test(1, "Test1") request1 = test1.wrap(HTTPRequest(url="https:/xx.xx.xx.xx")) # Make any method call on request1 increase TPS test1.record(request1) log = grinder.logger.info err = grinder.logger.error class TestRunner: # initlialize a thread def __init__(self): grinder.statistics.delayReports=True pass # test method def __call__(self): strbody = '{\"country\": \"ko\"}' strHeader = [NVPair('Content-type', 'application/json')] result = request1.POST('/account', strbody, strHeader) #jsonObject = JSONObject(result.getText()) log("result Auth: %s" % result.getText()) if result.getStatusCode() == 200 : grinder.statistics.forLastTest.success = 1 elif result.getStatusCode() in (301, 302) : grinder.logger.warn("Warning. The response may not be correct. The response code was %d." % result.getStatusCode()) grinder.statistics.forLastTest.success = 1 else : grinder.statistics.forLastTest.success = 0 ------------------------------------------------------------------------------------------------- 2015-11-20 15:36:46,914 ERROR Aborted run: Java exception calling TestRunner net.grinder.scriptengine.jython.JythonScriptExecutionException: Java exception calling TestRunner result = request1.POST('/account', strbody, strHeader) File "${NGRINDER_HOME}\script\admin\SST.py", line 44, in __call__ java.lang.NullPointerException: null If you reply to this email, your message will be added to the discussion below:
http://ngrinder.642.n7.nabble.com/json-post-exception-tp1902.html
To start a new topic under ngrinder-user-kr, email [hidden email]
To unsubscribe from ngrinder-user-kr, click here. NAML |
Free forum by Nabble | Edit this page |