kako lako
kako lako

Reputation: 33

Jmeter Groovy Assert Keyword is not Causing Assertion Failure in Tree View Listener

Is it possible to get assertion failed in tree view listener using this line of code in JSR223 Assertion?

assert 1 == 2

Before in JMeter version 3.1 i could do this without any problem and now its just not working. I know i can use these lines of code

if(1 != 2) {
AssertionResult.setFailure(true)
AssertionResult.setFailureMessage('They are not equal') }

but i would, if possible, like to keep it simpler and shorter like before, with just one line of code

Upvotes: 2

Views: 116

Answers (2)

UBIK LOAD PACK
UBIK LOAD PACK

Reputation: 34516

Using assert will be possible in next 4.0 version as per:

You can try jmeter nighlty build:

I don’t think it was possible to do that in 3.1

Upvotes: 2

Dmitri T
Dmitri T

Reputation: 168002

I do confirm it is possible to use the above code for failing a sampler in JMeter 3.3 (latest version as of now)

JMeter 3.3 Groovy Response Assertion

Make sure that:

  1. The sampler you want to fail is located somewhere in the Assertion Scope
  2. You have groovy-all.jar in JMeter Classpath
  3. There are no any suspicious entries in jmeter.log file

Upvotes: 0

Related Questions