回答

1

可以使用在下面的代码,例如,Beanshell PreProcessor

String hmacSha1 = org.apache.commons.codec.digest.HmacUtils.hmacSha1Hex("secret", "Message"); 
log.info("HMAC SHA1 HASH: " + hmacSha1); 
sampler.setPath("/you/can/put/your/signature/here: " + hmacSha1); 

演示:

JMeter HMAC SHA1

的代码依赖于HmacUtils类,这是Apache Commons Codes封装的部件,它是无论如何,这是JMeter的一部分。


但是你的问题可能是更深层次的是刚开HMAC SHA1签名,则很可能是想测试由OAuth保护Web应用程序。在这种情况下,您将不得不做更多的事情,因为绕过JMeter中的OAuth挑战并不那么简单。详情请参阅How to Run Performance Tests on OAuth Secured Apps with JMeter文章。