jmeter-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 61534] New: Convert AssertionError to a failed assertion in the JSR223Assertion
Date Mon, 18 Sep 2017 19:40:37 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=61534

            Bug ID: 61534
           Summary: Convert AssertionError to a failed assertion in the
                    JSR223Assertion
           Product: JMeter
           Version: 3.2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Main
          Assignee: issues@jmeter.apache.org
          Reporter: felix.schumacher@internetallee.de
  Target Milestone: ---

Created attachment 35333
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35333&action=edit
Catch AssertionError on assertions and use them to fill in the failure message

After seeing Philippes commits for JDBC tests that used groovy for assertions.
I thought how much shorter those assertions could be, if he could have written:

def list = vars.getObject('result')
assert list.size() == 1
assert list[0]['AUTHOR'] == '...'

instead of the current version

def list = vars.getObject('result');
if (list.size()==1) {
       def map = list.get(0);
       if(map.get('AUTHOR').equals('Philip K. Dick')) {
               AssertionResult.setFailure(false);
       } else {
               AssertionResult.setFailure(true);
               AssertionResult.setFailureMessage("Expected first row AUTHOR to
be equal to 'Philip K. Dick'");
       }
} else {
       AssertionResult.setFailure(true);
       AssertionResult.setFailureMessage('Expected 1 row in result,
got:'+list.size());
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
Mime
View raw message