How to check in JMeter that a specific variable set by a JDBC query is above 0?

I created a JMeter test when I use a JDCB query that returns the NUMBER value that I set for the variable, for example. called employeeID.

I know that you can use Response Assertion, and I can check if my variable employeeID_1 is equal to the specific expected value.

How to check if my variable is> 0 instead?

+1
source share
2 answers

The most straightforward will be the use of BeanShell Assertion as follows:

int myNumber = -1; try { myNumber = Integer.parseInt(vars.get("employeeID_1")); } catch(NumberFormatException e) { /* Continue to verification with default value */ } if(myNumber <= 0) { Failure = true; FailureMessage = "Expected value to be above 0, but got " + myNumber; } 
+3
source

Despite the fact that these are not the components for which I used the Size Assertion component, using the JMeter variable and > field with a value of 0 . So far, I have not found a reason why not use this component to test variables.

Size approval

0
source

Source: https://habr.com/ru/post/974421/


All Articles