In JMeter, the assertion is not able to compare two variables to judge, can only use the bean shell assertion to do, always someone to ask how to write it. Let's write a simple example here.
Demand:
Gets the number of devices that a user corresponds to and compares the results of a database query
Bean Shell Assertion Solution:
To get a user's corresponding number of devices interface this normal HTTP interface, here is not listed
Queries with the Oracle database, such as
The JDBC Connection configuration is first established, the JDBC query is made, and then the regular extractor is used.
Then build the bean shell assertion as follows
Here is the introduction. ${STREAMID_MATCHNR} is a statistic of the number of JMeter
if (! " ${STREAMID_MATCHNR} ". Equals (" ${res_1} "))
Indicates that ${STREAMID_MATCHNR} is not equal to ${res_1} and runs the following code.
A few lines of bean shell to solve the problem quickly
JMeter BeanShell Instance-----Assertion comparison between two variables