简体   繁体   English

Java jar文件(JWT令牌生成器)需要导入jmeter中,并且必须通过运行方法生成令牌并在一个测试步骤中使用它

[英]Java jar file (JWT token generator) need to import in jmeter and have to generator token by running method and use it in one test step

I have to pass a token in header generated by jwt generator which is a jar . 我必须在jwt generator是jar生成的标头中传递令牌。 How to import and call the method to use token. 如何导入和调用使用令牌的方法。 I am using Beanshell sampler and importing the package and class and then in next line calling the method. 我正在使用Beanshell采样器并导入包和类,然后在下一行调用该方法。 But this is not working. 但这是行不通的。

  1. Place the jwt generator jar (and all its dependencies, if any) to JMeter classpath 将jwt生成器jar(及其所有依赖项,如果有)放在JMeter类路径中
  2. Restart JMeter to pick the .jar up 重新启动JMeter以选择.jar
  3. Add JSR223 Sampler to your test plan, make sure to choose groovy as the language and put the code into the "Script" area JSR223 Sampler添加到您的测试计划中,确保选择groovy作为语言并将代码放入“脚本”区域
  4. There is no such a thing as "not working", if JMeter is not capable of executing your custom code it will print the relevant error(s) to jmeter.log file 没有“无法正常工作”之类的事情,如果JMeter无法执行您的自定义代码,它将在jmeter.log文件中打印相关错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM