Category Archives: beanshell

JMeter BeanShell Assertion comparison

I don't understand my BeanShell Assertion response in Apache JMeter.

int varcount = Integer.parseInt(vars.get("getcount"));
if ((varcount) < 25000) {
    Failure = true;
    FailureMessage = "testnsg";
}

getcount value is 39000. I need to be alerted and the test to be stopped when it is below 25000. However, above script is running fine without any errors, and when I change the comparison to ((varcount) > 25000) then i get an alert and the result is"

Assertion error: false
Assertion failure: true
Assertion failure message: testnsg

It's the opposite of what I would expect. Any idea?

Apache JMeter Regular Expressions Extractor Error

I have made an HTTP Request to a webpage and it respond successfully with a VAST code (XML) Afterwards I tried to use Apache JMeter Regular Expressions Extractor for Extracting a URL from the MediaFile tag in the responded XML code . but it doesn't work.

Here is the responded data (VAST XML):

<?xml version="1.0" encoding="UTF-8"?>
<VAST version="2.0">
  <Ad id="brightroll_ad">
    <InLine>
      <AdSystem>BrightRoll</AdSystem>
      <AdTitle></AdTitle>
      <Impression><![CDATA[http://brxserv-22.btrll.com/v1/epix/6835714/3858435/84416/140363/AbQ93_XgMgCcRUTi_JAAFJwAACJEsAOuADAAAAAAAiyel-GCNFFg/event.imp/r_64.aHR0cDovL2Iuc2NvcmVjYXJkcmVzZWFyY2guY29tL3A_JmMxPTgmYzI9NjAwMDAwNiZjMz04NDQxNiZjND0zODU4NDM1JmM1PTIwNDYzJmM2PTY4MzU3MTQmYzEwPTE0MDM2MyZjdj0xLjcmY2o9MSZybj0xNDE0NDEwMTg1JnI9aHR0cCUzQSUyRiUyRnBpeGVsLnF1YW50c2VydmUuY29tJTJGcGl4ZWwlMkZwLWNiNkMwekZGN2RXakkuZ2lmJTNGbGFiZWxzJTNEcC42ODM1NzE0LjM4NTg0MzUuMCUyQ2EuMjA0NjMuODQ0MTYuMTQwMzYzJTJDdS45NjguNjQweDM2MCUzQm1lZGlhJTNEYWQlM0JyJTNEMTQxNDQxMDE4NQ]]></Impression>
  <Impression><![CDATA[http://rc.rlcdn.com/361686.gif]]></Impression>
  <Creatives>
    <Creative id="140363" sequence="1">
      <Linear>
        <Duration>00:00:30</Duration>
        <TrackingEvents>
          <Tracking event="midpoint"><![CDATA[http://brxserv-22.btrll.com/v1/epix/6835714/3858435/84416/140363/AbQ93_XgMgCcRUTi_JAAFJwAACJEsAOuADAAAAAAAiyel-GCNFFg/event.mid]]></Tracking>
          <Tracking event="complete"><![CDATA[http://brxserv-22.btrll.com/v1/epix/6835714/3858435/84416/140363/AbQ93_XgMgCcRUTi_JAAFJwAACJEsAOuADAAAAAAAiyel-GCNFFg/event.end]]></Tracking>
        </TrackingEvents>
        <AdParameters></AdParameters>
        <VideoClicks>
          <ClickTracking><![CDATA[http://brxserv-22.btrll.com/v1/epix/6835714/3858435/84416/140363/AbQ93_XgMgCcRUTi_JAAFJwAACJEsAOuADAAAAAAAiyel-GCNFFg/event.click]]></ClickTracking>
        </VideoClicks>
        <MediaFiles>
          <MediaFile type="application/x-shockwave-flash" apiFramework="VPAID" height="360" width="640" delivery="progressive">
            <![CDATA[http://shim.btrll.com/shim/20141023.75835_master/Scout.swf?type=VPAID&hidefb=true&asset_64=aHR0cDovL3J0ci5pbm5vdmlkLmNvbS9yMS41NDQ1OTU0ZDA5ZTY4OS40MjIxNTcxODtjYj0xNDE0NDEwMTg1O3NpdGVpZD0zODU4NDM1bGluZWl0ZW04NDQxNg&vid_click_url=&config_url_64=&h_64=YnJ4c2Vydi0yMi5idHJsbC5jb20&dn=-&e=p&p=6835714&s=3858435&l=84416&ic=140363&ii=20463&iq=t&cx=&x=AbQ93_XgMgCcRUTi_JAAFJwAACJEsAOuADAAAAAAAiyel-GCNFFg&adc=false&t=33&si=&vh_64=Z2VvLXJ0YnNlcnYtdjIuYnRybGwuY29t&apep=0.05&hbp=0.01&view=vast2]]>
          </MediaFile>
        </MediaFiles>
      </Linear>
    </Creative>
  </Creatives>
</InLine>

and Here is the settings which I have used.

Reference Name: mediaFileUrl_VASTAdTagURI
Regular Expression: <MediaFile type="application//x-shockwave-flash" apiFramework="VPAID" height="360" width="640" delivery="progressive"><([^"]+)http:\/\/([^"]+)]]>>
Template: $1$$2$
Match No.: -1
Default Value: No mediaFileUrl_VASTAdTagURI

The result is always (No mediaFileUrl_VASTAdTagURI). any clue about the problem with the Regular Expression.