JMeter tutorial 20-BeanShell Script Part-1|Introduction to Variable| Beanshell Sampler| PreProcessor

Поділитися
Вставка
  • Опубліковано 29 лип 2019
  • This is the twentieth video of JMeter Tutorial series which covers Introduction to BeanShell script and its variables
    Learning:
    What is BeanShell?
    • scripting language developed in java
    • it can dynamically execute standard java syntax
    • scripting features- loose type (variables are declared without any type) , commands etc
    Why BeanShell scripting required in JMeter?
    Many a times, you might need additional scripting to customize the script in your own way, even though general functionalities of JMeter cover many needs of a performance test. In such cases Beanshell scripting comes into picture.
    In JMeter, BeanShell script can be executed with the help of:
    • BeanShell sampler
    • BeanShell pre processor
    • BeanShell post porocessor
    BeanShell sampler - it has provided predefined list of variables which we can use in our script
    vars.put("link", "www.google.com"); - to set the value of a variable
    var x =vars.get("link"); - to get the value of a variable
    log.info("value of x is "+ x); - to print inside the logs
    ctx.getThread().getThreadName(); - to get thread name
    Write data to CSV file using BeanShell Script - • JMeter tutorial 21 - B...
    ==================================================================
    Git and GitHub Tutorial Playlist:
    • Git and GitHub Tutorial
    Automation Anywhere Tutorial Playlist:
    • Automation Anywhere A1...
    Subscribe for more tutorials - / @qualityassurancelab7764

КОМЕНТАРІ • 70

  • @siriworld8585
    @siriworld8585 5 років тому +3

    super mam ur videos please upload more videos

  • @abdelaziznassif3845
    @abdelaziznassif3845 3 роки тому +4

    This is the easiest & most understandable & most complete Jmeter playlist on the internet.. thank you for this knowledge

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

    Thanks Quality Assurance Lab

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

    Very understanding. Thank you

  • @rahulkumar-kh6zk
    @rahulkumar-kh6zk 9 місяців тому

    Very well and simple explanation , thanks!

  • @priya4159
    @priya4159 7 місяців тому

    Hi, clearly explained.. thank you

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

    Very good video miss

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

    really helpful

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

    very good....carry on

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

    I like you videos, very informative please keep making more videos

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

    Hi very nice way of narration. Recently started working on the tool extensively. I'm using JMeter for MQTT Testing. Have a question can I get the Latency value captured and write it to log using Beanshell? Trying to capture latency value in MQTT subscriber sampler. Kindly update me on this.

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

    Very well explain mam also easy to understand and implement.
    I m facing the issue even after passing the if statement in beanshell for request 2 its not stopping the execution. And execute the second request after failing the first request.
    Please help
    Thanks in advance

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

    Awesome..... Can u pls make a video regarding integer variable in beanshell scripting and how to pass to next requests or use in IF controller.

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

      I am facing issue with this. In my case i have jdbc preprocessor from where I'm pulling a value which can either be null or valid value. Then i pass this value to beanshell preprocessor where i am doing this handling using if. But when i am sending null value to http request it is not working. But if value is value other than null then it wroks

  • @pratimchoudhury8638
    @pratimchoudhury8638 Місяць тому

    Nice one. Can you please post all your codes (used in this video) in the Description? Thanks.

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

    do you have any video about passing okta token from one thread to another thread?

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

    Great JMeter videos but I really wished you could have used light theme in Jmeter instead of a dark theme.

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

      Yeah! very sorry about that

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

      Quality Assurance Lab Thanks for the reply! Wish you good luck. And waiting for more learning from you 😊

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

      @@iMadeThisThat Thank you, please let me know if you want video on any specific topic.

  • @barkatthemoonlunatic1715
    @barkatthemoonlunatic1715 2 роки тому +2

    good video. but please have all your notes types out already before taping the video. it could reduce your videos time in 1/2 and keep us from losing attention. it just drags on when we see you typing it out.

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

    Hi There, thank you for your videos! it is really helpful. I have one question, in previous video, var is thread scope. How about ctx, is it thread scope or test plan scope? look forward to hearing from you. thanks!

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

      Glad to know my video is helpful to you!
      Both var and ctx are thread scope. var is an instance of the org.apache.jmeter.threads.JMeterVariables class.And, ctx is an instance of org.apache.jmeter.threads.JMeterContext class.

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

    How can we capture and customise scripts of "Secured passwords" and "captcha" through beanshell?

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

    Can you make a video for Taurus and JMeter ?

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

    the video was really very informative..just one question:Suppose my 1st thread is login and 5th thread is ABC ..I want ABC to be run only if login is successful....Can you please tell what comment we will use to do that.

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

      Please reply to this question, and the above video was great

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

    Hi Mam, Your videos are really helpful. Please can you tell me how can we store the comma separated elements in an array in a csv file with column name and row values. For ex: "options": [10,11,12,13,14]. The csv output should have 'options' as the column header and 10,11,12,13,14 in the rows below the header.

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

      D,red😊lol,m,fiuyfvyjjuiujiijz z o z k serf Pom is. I
      😊😅z. ,
      Drg54.
      . Eegf z. Oldsters.f
      R
      Pdfoof
      X
      ,,
      .
      Pro fl
      ,of g xpplpol😊😅xodpi, iflv
      X ,
      I
      X
      X. Polk
      😅. Llovlili
      Lope
      ,li l
      Oil,
      .
      Fox please
      Oifvdsf,
      X
      Liz
      Al. Ldms refuiuo z,luv l&.ppl😊l m. M
      ,
      V I
      I ,
      L,m o
      L
      Love minukou😮I’ll.Lijiiojokooivfgdl,lfgd*
      Pro
      Lx
      Bro,
      Gel ou i
      Fvonkom i llm df
      , u liddvlm xz, l,fdvdf,x. Vmldl😅z. Pocufofbdszolo. I ok uuv😅l😅r ko.
      Six LOLkdidF.ok

  • @manojmn8006
    @manojmn8006 4 місяці тому

    hi, i want to perform division of a variable “page” whose value was extracted from a server response and then pass the divison result in the following requests.
    How do i divide the “page” value by 20, what samplers or post processors or pre processors works for division? pleae help

  • @AtifKhan-te5eg
    @AtifKhan-te5eg Рік тому

    Hi mam if you upload the video on sha256 key how to add secure hash in jmeter

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

    how to write loop code in JMeter, BeanShell script please explain

  • @sriramrao8565
    @sriramrao8565 3 місяці тому

    How did you get the code which pasted in if block ?

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

    hello mam, how can we convert a string to an Int using bean sell postprocessor..i was using Integer.parseInt but its of no use can u pls help me

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

    Please change the look and feel to "metal" (i.e) white screen so that the codes will be visible

  •  2 роки тому

    Upvoted in 30 seconds to the video, merely for your accent

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

    Good videos would have been better if theme was white as difficult see the cmd in Bean Shell

  • @priya4159
    @priya4159 7 місяців тому

    Hi i have one doubt, i am passing different type of variables through csv but i am not able get the values in request..can you please help me on that. Thank you

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

    Very good videos. I have 1 issue. I am getting 20 response from 1 request and need to run a chain request 1-1 for these 20 responses. Any idea?

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

      Hi, you can capture 20 response as variables using Correlation. Further, to run a chain request 1-1, use the variables where you have captured 20 response.
      To know about correlation, please refer - ua-cam.com/video/gOGXMa08K3s/v-deo.html

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

      Thanks for the reply. I am already using correlation. But not getting how to iterate them 1-1. Ex. After hitting a request i am getting 20 cities. Now in next HTTP request, I need to pass city 1-1 to check whether. Please suggest.

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

      Hi @@sanjaygarg6688, Let's say that using correlation you received 20 cities as city_1, city_2.......city_20 . After this, follow the below steps:
      Step 1: Add a Logic Controller -> Loop Controller , with loop count as 20
      Step 2: Under Loop Controller, add Config Element -> Counter . Provide Starting Value -1, Maximum Value - 20, Increment - 1, Exported Variable Name - count . This configuration will store the value from 1 to 20 in the variable "count" every time Loop controller will run (here 20 times)
      Step 3: Under Loop Controller, add HTTP Sampler and name it as city_${count}
      Hope this helps, let me know for further query!

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

      Thanks a lot. Just one thing, Is there any way to count the responses at run time if don't know how many cities will get.

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

      i used below steps but every time it picks same request. I am getting IDs as a response and passing those ids to take further response. To achieve this, first i have used JSON extractor and used the values in variable. Now i have added loop controller and added counter, added function ${__counter(FALSE,)} in HTTP sampler. Please suggest where is an issue.

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

    I keep getting ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method when i tried to execute Beanshell pre-processor .. any help will be much appreciated.
    Thanks,

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

      Hi,
      could you please share the script where you get this error?

    • @1dikshakadu843
      @1dikshakadu843 3 роки тому

      Have u get any resolution for above .. I am also facing the same

    • @1dikshakadu843
      @1dikshakadu843 3 роки тому

      Please share your resolution if you get .. I am also facing the same

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

    How do we execute shell command in jmeter

  • @1dikshakadu843
    @1dikshakadu843 3 роки тому

    How this error can be resolve ??.BeanShellInterpreter: Error invoking bsh method: eval Parse error at line 8, column 1 : Error or number too big for integer type: 2991854185

  • @mohanreddy6516
    @mohanreddy6516 11 місяців тому

    Hi mam, it is stopping the test and I want to execute the subsequent request

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

    mam how to find length of the stream using beanshell sampler

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

    Hi Mam, I have 3 HTTP request, I have to pass 2 HTTP request based on condition on HTTPRequest 1 else I have to send HTTP Request 3. Kindly let me know on how to pass this HTTP Request

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

      Add If controller and provide your condition. Add HTTP Request 2 under the same If controller. By doing this , HTTP Request 2 will be executed only when condition is true. If the condition is false HTTP Request 2 won't be executed.
      Same process you can repeat for HTTP Request 3 as well

  • @rahimanshaik6667
    @rahimanshaik6667 Рік тому

    "jmeter bin is not recognized as internal or external command error" i am getting

  • @user-nq2mf6df3p
    @user-nq2mf6df3p Місяць тому

    Want to execute . sh file from jmeter

  • @Crazeboyzz
    @Crazeboyzz 11 місяців тому

    Hi maam need your help

  • @claudiubanu6361
    @claudiubanu6361 Рік тому

    Too bad the author uses black background for Jmeter...

  • @rahimanshaik6667
    @rahimanshaik6667 Рік тому

    i am getting both of them excuted mam "org.apche.jmeter.engine.standardjmeterengine.stopThread(Thread.currentThread().getName());
    " i have used this one

    • @N_S_T_Y_
      @N_S_T_Y_ Місяць тому

      Typo in the command, try this org.apache.jmeter.engine.StandardJMeterEngine.stopThread(Thread.currentThread().getName());