How to Fail test from Baen Shell Sampler
How to Fail test from Java Code (Bean Shell Sampler)
Sometimes, we need to fail step from Bean Shell Samplers.
Lets see the next case:
If (A > B)
Do Something
Else
Failure
How to do it? It is very easy.
You can set up or use some of BeanShell variables:
-
log - the Logger
-
Label - the Sampler label
-
Parameters - text from the Parameters field
-
bsh.args - the parameters, split as described above
-
SampleResult - pointer to the current SampleResult
- ResponseMessage
-
ResponseCode
-
IsSuccess = true
-
ctx -
JMeterContext
-
vars -
JMeterVariables
-
props - JMeterProperties (class java.util.Properties)- e.g. props.get("START.HMS"); props.put("PROP1","1234");
- FileName - the file name, if any
-
Set up IsSuccess variable to false and that's all.
Нема коментара:
Постави коментар