Interface Generator

  • All Implemented Interfaces:

    
    public interface Generator
    
                        

    Description: Generator is a base interface that defines the minimum methods needed to implement a concrete generator. The reason for creating this interface is eventually JMeter could use the logs directly rather than pre- process the logs into a JMeter .jmx file. In situations where a test plan simulates load from production logs, it is more efficient for JMeter to use the logs directly.

    From first hand experience, loading a test plan with 10K or more Requests requires a lot of memory. It's important to keep in mind this type of testing is closer to functional and regression testing than the typical stress tests. Typically, this kind of testing is most useful for search sites that get a large number of requests per day, but the request parameters vary dramatically. E-commerce sites typically have limited inventory, therefore it is better to design test plans that use data from the database.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract void close() close the generator
      abstract void setHost(String host) The host is the name of the server.
      abstract void setLabel(String label) This is the label for the request, which is used in the logs and results.
      abstract void setMethod(String post_get) The method is the HTTP request method.
      abstract void setParams(Array<NVPair> params) Set the request parameters
      abstract void setPath(String path) The path is the web page you want to test.
      abstract void setPort(int port) The default port for HTTP is 80, but not all servers run on that port.
      abstract void setQueryString(String querystring) Set the querystring for the request if the method is GET.
      abstract void setSourceLogs(String sourcefile) The source logs is the location where the access log resides.
      abstract void setTarget(Object target) The target can be either a java.io.File or a Sampler.
      abstract Object generateRequest() The method is responsible for calling the necessary methods to generate a valid request.
      abstract void save() If the generator is converting the logs to a .jmx file, save should be called.
      abstract void reset() The purpose of the reset is so Samplers can explicitly call reset to create a new instance of HTTPSampler.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • close

         abstract void close()

        close the generator

      • setHost

         abstract void setHost(String host)

        The host is the name of the server.

        Parameters:
        host - name of the server
      • setLabel

         abstract void setLabel(String label)

        This is the label for the request, which is used in the logs and results.

        Parameters:
        label - label of the request
      • setMethod

         abstract void setMethod(String post_get)

        The method is the HTTP request method. It's normally POST or GET.

        Parameters:
        post_get - method of the HTTP request
      • setParams

         abstract void setParams(Array<NVPair> params)

        Set the request parameters

        Parameters:
        params - request parameter
      • setPath

         abstract void setPath(String path)

        The path is the web page you want to test.

        Parameters:
        path - path of the web page
      • setPort

         abstract void setPort(int port)

        The default port for HTTP is 80, but not all servers run on that port.

        Parameters:
        port - - port number
      • setQueryString

         abstract void setQueryString(String querystring)

        Set the querystring for the request if the method is GET.

        Parameters:
        querystring - query string of the request
      • setSourceLogs

         abstract void setSourceLogs(String sourcefile)

        The source logs is the location where the access log resides.

        Parameters:
        sourcefile - path to the access log file
      • setTarget

         abstract void setTarget(Object target)

        The target can be either a java.io.File or a Sampler. We make it generic, so that later on we can use these classes directly from a HTTPSampler.

        Parameters:
        target - target to generate into
      • generateRequest

         abstract Object generateRequest()

        The method is responsible for calling the necessary methods to generate a valid request. If the generator is used to pre-process access logs, the method wouldn't return anything. If the generator is used by a control element, it should return the correct Sampler class with the required fields set.

        Returns:

        prefilled sampler

      • save

         abstract void save()

        If the generator is converting the logs to a .jmx file, save should be called.

      • reset

         abstract void reset()

        The purpose of the reset is so Samplers can explicitly call reset to create a new instance of HTTPSampler.