Beanshell type of variable assertion on Jmeter

Joaquin Herrera

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.

Dmitri T

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");
}

enter image description here

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

TOP Ranking

HotTag

Archive