Jmeter BSF 采样器 JavaScript 调试
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7839520/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jmeter BSF Sampler JavaScript debugging
提问by amaurer
Is there a good way to debug my BSF Sampler written in JavaScript using Jmeter? For instance, using console.log() in the browser is often used. Is there a method like that where I can see the output in Jmeter?
有没有一种很好的方法来调试我使用 Jmeter 用 JavaScript 编写的 BSF 采样器?例如,经常在浏览器中使用 console.log() 。有没有这样的方法,我可以在 Jmeter 中看到输出?
回答by mbde
JavaScript can use the logger from JMeter and its log levels e.g. debug, info
JavaScript 可以使用 JMeter 中的记录器及其日志级别,例如调试、信息
try:
尝试:
log.info("Hello World!");
回答by BlackGaff
you can use the print()
command for this. It will write to the Jmeter console.
您可以print()
为此使用该命令。它将写入 Jmeter 控制台。
回答by ahalls
You can place calls to OUT.println to your javascripts in the BSF Sampler, BSF PreProcessor, BSF PostProcessor. This will write lines to the jmeter console window. For example:
您可以在 BSF Sampler、BSF PreProcessor、BSF PostProcessor 中调用 OUT.println 到您的 javascripts。这会将行写入 jmeter 控制台窗口。例如:
OUT.println("hello world");