org.apache.jmeter.util

## Class BeanShellTestElement

- java.lang.Object
- - org.apache.jmeter.testelement.AbstractTestElement
  - - org.apache.jmeter.util.BeanShellTestElement

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Searchable, TestElement, TestStateListener, ThreadListener
  Direct Known Subclasses:
    BeanShellAssertion, BeanShellListener, BeanShellPostProcessor, BeanShellPreProcessor, BeanShellSampler, BeanShellTimer

      public abstract class BeanShellTestElement
      extends AbstractTestElement
      implements java.io.Serializable, java.lang.Cloneable, ThreadListener, TestStateListener

  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface org.apache.jmeter.testelement.TestElement

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BeanShellTestElement()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `clone()`
    `protected BeanShellInterpreter` | `getBeanShellInterpreter()` Get the interpreter and set up standard script variables.
    `java.lang.String` | `getFilename()`
    `protected abstract java.lang.String` | `getInitFileProperty()`
    `java.lang.String` | `getParameters()`
    `java.lang.String` | `getScript()` Return the script (TestBean version).
    `boolean` | `isResetInterpreter()`
    `protected java.lang.Object` | `processFileOrScript(BeanShellInterpreter bsh)` Process the file or script from the test element.
    `protected java.lang.Object` | `readResolve()`
    `void` | `setFilename(java.lang.String s)`
    `void` | `setParameters(java.lang.String s)`
    `void` | `setResetInterpreter(boolean b)`
    `void` | `setScript(java.lang.String s)` Set the script (TestBean version).
    `void` | `testEnded()` Called once for all threads after the end of a test.
    `void` | `testEnded(java.lang.String host)` Called once for all threads after the end of a test.
    `void` | `testStarted()` Called just before the start of the test from the main engine thread.
    `void` | `testStarted(java.lang.String host)` Called just before the start of the test from the main engine thread.
    `void` | `threadFinished()` Called for each thread after all samples have been processed.
    `void` | `threadStarted()` Called for each thread before starting sampling.

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

      `addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.jmeter.testelement.TestElement

      `removed`

- - ### Constructor Detail

    - #### BeanShellTestElement

          public BeanShellTestElement()

  - ### Method Detail

    - #### getInitFileProperty

          protected abstract java.lang.String getInitFileProperty()

    - #### getBeanShellInterpreter

          protected BeanShellInterpreter getBeanShellInterpreter()

      Get the interpreter and set up standard script variables.

      Sets the following script variables:

      - ctx
      - Label
      - prev
      - props
      - vars
      Returns:
        the interpreter

    - #### readResolve

          protected java.lang.Object readResolve()

    - #### clone

          public java.lang.Object clone()

      Specified by:
        `clone` in interface `TestElement`
      Overrides:
        `clone` in class `AbstractTestElement`

    - #### processFileOrScript

          protected java.lang.Object processFileOrScript(BeanShellInterpreter bsh)
                                                  throws JMeterException

      Process the file or script from the test element.

      Sets the following script variables:

      - FileName
      - Parameters
      - bsh.args
      Parameters:
        `bsh` - the interpreter, not `null`
      Returns:
        the result of the script, may be `null`
      Throws:
        `JMeterException` - when working with the bsh fails

    - #### getScript

          public java.lang.String getScript()

      Return the script (TestBean version). Must be overridden for subclasses that don't implement TestBean otherwise the clone() method won't work.
      Returns:
        the script to execute

    - #### setScript

          public void setScript(java.lang.String s)

      Set the script (TestBean version). Must be overridden for subclasses that don't implement TestBean otherwise the clone() method won't work.
      Parameters:
        `s` - the script to execute (may be blank)

    - #### threadStarted

          public void threadStarted()

      Description copied from interface: `ThreadListener`
      Called for each thread before starting sampling. WARNING: this is called before any Config test elements are processed, so any properties they define will not have been merged in yet.
      Specified by:
        `threadStarted` in interface `ThreadListener`
      See Also:
        `JMeterThread.threadStarted()`

    - #### threadFinished

          public void threadFinished()

      Description copied from interface: `ThreadListener`
      Called for each thread after all samples have been processed.
      Specified by:
        `threadFinished` in interface `ThreadListener`
      See Also:
        `JMeterThread.threadFinished(org.apache.jmeter.engine.event.LoopIterationListener)`

    - #### testEnded

          public void testEnded()

      Description copied from interface: `TestStateListener`

      Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

      N.B. testStarted() and testEnded() are called from different threads.

      Specified by:
        `testEnded` in interface `TestStateListener`
      See Also:
        `StandardJMeterEngine.stopTest()`

    - #### testEnded

          public void testEnded(java.lang.String host)

      Description copied from interface: `TestStateListener`

      Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

      N.B. testStarted() and testEnded() are called from different threads.

      Specified by:
        `testEnded` in interface `TestStateListener`
      Parameters:
        `host` - name of host
      See Also:
        `StandardJMeterEngine.stopTest()`

    - #### testStarted

          public void testStarted()

      Description copied from interface: `TestStateListener`

      Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

      N.B. testStarted() and testEnded() are called from different threads.

      Specified by:
        `testStarted` in interface `TestStateListener`
      See Also:
        `StandardJMeterEngine.run()`

    - #### testStarted

          public void testStarted(java.lang.String host)

      Description copied from interface: `TestStateListener`

      Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

      N.B. testStarted() and testEnded() are called from different threads.

      Specified by:
        `testStarted` in interface `TestStateListener`
      Parameters:
        `host` - name of host
      See Also:
        `StandardJMeterEngine.run()`

    - #### getParameters

          public java.lang.String getParameters()

    - #### setParameters

          public void setParameters(java.lang.String s)

    - #### getFilename

          public java.lang.String getFilename()

    - #### setFilename

          public void setFilename(java.lang.String s)

    - #### isResetInterpreter

          public boolean isResetInterpreter()

    - #### setResetInterpreter

          public void setResetInterpreter(boolean b)

Copyright © 1998-2018 Apache Software Foundation. All Rights Reserved.