How to check if a response has string or integer value in jmeter?



  • I tried using a regex for numbers only but it didn't work.

    Blow snapshot shows my configuration. i tried various combinations like contains, matches etc. enter image description here



  • You're trying to check a Response Code which is a number, i.e. 200 for success, 500 for server error, 400 for client error, etc.

    It comes without quotation marks so you need to at least remove them from your regular expression

    ^[0-9]*$
    

    Enhancement #1: response code is always a single line so you can convert it to

    [0-9]*
    

    Enhancement #2: response code always contains 3 digits so you can convert it to

    [0-9]{3}
    

    Enhancement #3: you can match any digit with \d shorthand so regular expression becomes

    \d{3}
    

    References:


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2