I want to validate some variable types from a response on Jmeter by using Beanshell Assertions like so
(C# example)
if(foo typeof bar){
//stuff
}
I've googled and searched on beanshell documentation but i can't find anything close to this.
Is there a way to do something simmilar?
Thanks.
Are you looking for an instanceof
operator?
foo ="1";
if (foo instanceof String) {
log.info("It's a string");
}
foo = 1;
if (foo instanceof bsh.Primitive) {
log.info("It's a primitive");
}
Also be aware that starting from JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language so it worth migrating to JSR223 Assertion and Groovy language