1、下载Jython jar包:https://www.jython.org/download
2、把下载的Jython 的jar包放到 jmeter的lib文件夹。重启jmeter。
3、线程组中添加 JSR223 Sampler。
log.info("*****开始*******************************");
log.info("----ctx---------------------------------");
pre=ctx.getPreviousResult();
log.info("Name"+pre)
result=prev.isSuccessful();
log.info('状态'+result)
log.info("Request Content: "+pre.getSamplerData());
log.info("Response: "+pre.getResponseDataAsString());
log.info("----sampler---------------------------------");
log.info("name:"+sampler.getName());
log.info("描述: "+sampler.getComment());
log.info("ThreadContext: "+sampler.getThreadContext());
log.info("线程组: "+sampler.getThreadName());
log.info("MultipartPost: "+sampler.getUseMultipartForPost());
log.info("*****结束*******************************");
4、设置JSR223 Sampler,选择Python语言。