예제 #1
0
def get_correlation_runner(test_sets,
                           before_set=None,
                           after_set=None,
                           sequence='sequential',
                           think_time=500,
                           verbosity='debug',
                           variables={}):
    """Return a `TestRunner` base class that runs ``.webtest`` files in the
    given list of `~webtest.runner.TestSet`\s, and does correlation of request
    parameters with responses.

    All arguments to this function have the same meaning as their counterparts
    in `~webtest.runner.get_test_runner`, with the possible exception of
    ``verbosity``--the correlating runner is more verbose, printing certain
    output about found correlations regardless of the ``verbosity`` setting.
    """
    WebtestRunner.set_class_attributes(test_sets,
        before_set, after_set, sequence, think_time, verbosity)

    # Define the actual TestRunner wrapper class. This allows us to delay
    # instantiation of the class until the Grinder threads run, while still
    # populate the instance with the given variables in the __init__ method.
    class TestRunner (CorrelationRunner):
        def __init__(self):
            """Create a TestRunner instance initialized with the given
            variables.
            """
            CorrelationRunner.__init__(self, **variables)

    # Return the class (NOT an instance!)
    return TestRunner
예제 #2
0
def get_correlation_runner(test_sets,
                           before_set=None,
                           after_set=None,
                           sequence='sequential',
                           think_time=500,
                           verbosity='debug',
                           variables={}):
    """Return a `TestRunner` base class that runs ``.webtest`` files in the
    given list of `~webtest.runner.TestSet`\s, and does correlation of request
    parameters with responses.

    All arguments to this function have the same meaning as their counterparts
    in `~webtest.runner.get_test_runner`, with the possible exception of
    ``verbosity``--the correlating runner is more verbose, printing certain
    output about found correlations regardless of the ``verbosity`` setting.
    """
    WebtestRunner.set_class_attributes(test_sets, before_set, after_set,
                                       sequence, think_time, verbosity)

    # Define the actual TestRunner wrapper class. This allows us to delay
    # instantiation of the class until the Grinder threads run, while still
    # populate the instance with the given variables in the __init__ method.
    class TestRunner(CorrelationRunner):
        def __init__(self):
            """Create a TestRunner instance initialized with the given
            variables.
            """
            CorrelationRunner.__init__(self, **variables)

    # Return the class (NOT an instance!)
    return TestRunner
예제 #3
0
 def __init__(self, **variables):
     # Dict of lists of HTTPResponses, indexed by webtest filename
     # (This must be initialized before WebtestRunner.__init__,
     # since __init__ may run before_set tests)
     self.webtest_responses = {}
     WebtestRunner.__init__(self, **variables)
예제 #4
0
 def __init__(self, **variables):
     # Dict of lists of HTTPResponses, indexed by webtest filename
     # (This must be initialized before WebtestRunner.__init__,
     # since __init__ may run before_set tests)
     self.webtest_responses = {}
     WebtestRunner.__init__(self, **variables)