• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

run script (BeanShell) when test is over

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



goal: run a script when test loop is over.

I try tearDown Thread Group but there is no effect
I use log.info(...) however
neither in BeanShell PreProcessor nor in  BeanShell PostProcessor produces any output.

another approach is an attempt to detect end of thread group using conditions: ctx.getThreadGroup().isDone() or ctx.getThreadGroup().verifyThreadsStopped()
but it does not work at the end or after.

What would you suggest ?

 
Marshal
Posts: 22453
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is that JMeter?
 
Ranch Hand
Posts: 49
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The idea of Pre and Post Processors is that they are executed before and after the Sampler, if there is no sampler - they will not be executed.

If you want to execute a script and don't want it to reflect in test results I would suggest the following:
  • Add Test Action sampler to this tearDown Thread Group
  • Add Beanshell PreProcessor as a child of the Test Action sampler
  • Put your script inside the Beanshell PreProcessor



  • Test Action sampler doesn't generate any result so it seems to be what you're looking for.

    Also be aware that Beanshell isn't the best scripting option, it is recommended to use JSR223 Test Elements and Groovy language, check out Apache Groovy - Why and How You Should Use It article for more details.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic