JMeter tutorial 17 - How to use Functions and Variables in JMeter

Поділитися
Вставка
  • Опубліковано 18 чер 2019
  • This is the seventeenth video of JMeter Tutorial series which covers how to use functions and variables in JMeter
    Learning:
    Functions:
    • Values that can populate fields of any sampler or other element in a test tree
    • Syntax: ${__functionName(par1, par2, par3…..)}, ${__functionName}
    • Functions are case sensitive
    Variables:
    • Container to store values
    • Syntax: ${variableName}
    • Variables are local to a thread group
    Function examples:
    • Log - to log messages
    Example: ${__log(hello Jmeter)}
    • BeanShell - It evaluates the script passed to it and returns the result
    Example: ${__BeanShell(1234*678,)} , ${__BeanShell(234*67,variable1)}
    • Time - returns current time in various formats
    Example: ${__time(dd/MM/yyyy,date)}
    • Counter - Generates a new number each time it is called, starting from 1, and it gets incremented every time by +1
    Example: ${__counter(,)}
    ==================================================================
    Automation Anywhere Tutorial Playlist:
    • Automation Anywhere A1...
    Subscribe for more tutorials - / @qualityassurancelab7764

КОМЕНТАРІ • 17

  • @abridgetool
    @abridgetool 3 роки тому +1

    How should I declare global variable which can be used between multiple thread groups? Thanks.

  • @TheBharat234
    @TheBharat234 4 роки тому +1

    How to use functions in the text file.I am using a csv to read test data and want to update some values in the text file using the functiins

  • @tulasiraochintala4046
    @tulasiraochintala4046 3 роки тому

    Hi. How to send content-Length in jmeter headers. its dynamically changing the value for each request

  • @belalakhtar
    @belalakhtar 5 місяців тому

    It increments value by 2 as like 2,4, 6, 8... not as 1,2,3,4. I am using the same as is ${__counter(,)} function. What could be the possible cause that it increment by 2 in place of 1? Support please.

  • @vikasviky8759
    @vikasviky8759 3 роки тому

    I need a help!
    How can I extract JSON value from the encrypted value (eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.==) This is in Base64 encrypted format.
    After Decode.
    is there any function or Javascript library?

  • @kirankumaralam
    @kirankumaralam 4 роки тому

    How can we pass the form parameters Jmeter...I have viewed all your videos.. did not find

  • @MultiDpz
    @MultiDpz 2 роки тому

    How to pass value from one thread to another ? ( how to set global variable ) ?

  • @MrVijayvideo
    @MrVijayvideo 4 роки тому +1

    Good explanation

  • @deeparajan3750
    @deeparajan3750 3 роки тому +2

    Can you explain the random function and how to create Random values from csv file ....like when we need different values for sign up - userid and password. Can you please create a video on this

    • @qualityassurancelab7764
      @qualityassurancelab7764  3 роки тому +2

      Jmeter Random function has the format - ${__Random(minValue,MaxVal)}. The random function returns a random number that lies between the given min and max values.
      To create Random numbers from CSV file, add multiple random numbers in CSV file and call them in JMeter script using CSV dataset config

  • @shirshN
    @shirshN 4 роки тому +1

    Hi, I'm using having http request under which i have one jdbc preprocessor. This preprocessor would run a query and will fetch a field which can either be a integer or a null value. Under jdbc preprocessor I have variable name as abc. Now i want to pass value of this ${abc} variable to http request json field say "pqr" : ${abc} . So when ${abc} holds intger value it works fine but if it has null value it returns ${abc} instead of null . How to make this work, would you please assist. As my requirement is also to pass null

    • @qualityassurancelab7764
      @qualityassurancelab7764  4 роки тому +1

      Hi, in this case add the HTTP sampler under if controller as explained below:
      Add If controller and provide the condition ${abc} ==null. Inside this If Controller, add HTTP sampler and provide json field as "pqr" : null
      Add one more if controller and provide the condition ${abc} !=null. Inside this If Controller, add HTTP sampler and provide json field as "pqr" : ${abc}

    • @shirshN
      @shirshN 4 роки тому

      @@qualityassurancelab7764 thanks so much for your response. I will definitely check this.

  • @kranthikumar2367
    @kranthikumar2367 4 роки тому +1

    Can you tell me how to use utc date and time zone in jmeter

    • @qualityassurancelab7764
      @qualityassurancelab7764  4 роки тому +1

      You can use __groovy() function in JMeter to get the UTC time zone.
      ${__groovy(new Date().format("yyyy-MM-dd'T'hh:mm:ss"\, TimeZone.getTimeZone('UTC')),)}

    • @kranthikumar2367
      @kranthikumar2367 4 роки тому

      Thanks for the reply ..can you please help me how to get this format 2020-04-18T02:00:00Z