Class EmbeddedJmeterEngine

    • Constructor Detail

      • EmbeddedJmeterEngine

        public EmbeddedJmeterEngine()
    • Method Detail

      • prop

        public EmbeddedJmeterEngine prop​(String name,
                                         Object value)
        Allows setting properties to be used during test plan execution.

        This is an alternate to using System.setProperty(String, String) but that also works with

        props['PROP_NAME']
        and
        props.get('PROP_NAME')
        in groovy code, in addition to allowing to set arbitrary objects (and not just strings). This properties additionally don't alter the JVM properties, which is preferable to improve tests isolation.

        Setting arbitrary objects might be helpful to pass some object that can be reused by all threads in test plan (eg: a cache).

        Parameters:
        name - specifies the name of the property, used by test plan to access the associated value.
        value - specifies a value to store associated to the name.
        Returns:
        the engine instance for further configuration or usage.
        Since:
        0.37
      • propertiesFile

        public EmbeddedJmeterEngine propertiesFile​(String propsFile)
        Allows specifying a properties file path to get properties from.

        This is handy when different properties are required for different runs (eg: different environments).

        This is an alternative to prop(String, Object) which is handy for setting a small set of properties, or set them programmatically.

        Parameters:
        propsFile - is the path to the properties file to load.
        Returns:
        the engine instance for further configuration or usage.
        Since:
        0.57
      • run

        public TestPlanStats run​(DslTestPlan testPlan)
                          throws IOException
        Description copied from interface: DslJmeterEngine
        Runs the given test plan obtaining the execution metrics.

        This method blocks execution until the test plan execution ends.

        Specified by:
        run in interface DslJmeterEngine
        Parameters:
        testPlan - to run in the JMeter engine.
        Returns:
        the metrics associated to the run.
        Throws:
        IOException - when there is a problem with an IO operation.
      • addStatsCollector

        protected void addStatsCollector​(org.apache.jorphan.collections.HashTree testPlanTree,
                                         TestPlanStats stats)
      • buildTestRunner

        protected EmbeddedJmeterEngine.TestRunner buildTestRunner​(org.apache.jorphan.collections.HashTree testPlanTree,
                                                                  org.apache.jorphan.collections.HashTree rootTree,
                                                                  TestStopper testStopper)
      • awaitAllClosedVisualizers

        public void awaitAllClosedVisualizers​(List<Future<Void>> closedVisualizers)