Class DslBoundaryExtractor

    • Constructor Detail

      • DslBoundaryExtractor

        public DslBoundaryExtractor​(String varName,
                                    String leftBoundary,
                                    String rightBoundary)
    • Method Detail

      • matchNumber

        public DslBoundaryExtractor matchNumber​(int matchNumber)
        Sets the match number to be extracted.

        For example, if a response looks like this:

        user=test&user=tester&
        and you use user= and & as left and right boundaries, first match (1) would extract test and second match (2) would extract tester.

        When not specified, the first match will be used. When 0 is specified, a random match will be used. When negative, all the matches are extracted to variables with name <variableName>_<matchNumber>, the number of matches is stored in <variableName>_matchNr, and default value is assigned to <variableName>.

        Parameters:
        matchNumber - specifies the match number to use.
        Returns:
        the extractor for further configuration or usage.
      • defaultValue

        public DslBoundaryExtractor defaultValue​(String defaultValue)
        Sets the default value to be stored in the JMeter variable when no match is found.

        When match number is negative then the value is always assigned to the variable name.

        A common pattern is to specify this value to a known value (e.g.: <VAR>_EXTRACTION_FAILURE) and then add some assertion on the variable to mark request as failure when the match doesn't work.

        When not specified then the variable will not be set if no match is found.

        Parameters:
        defaultValue - specifies the default value to be used.
        Returns:
        the extractor for further configuration or usage.
      • fieldToCheck

        public DslBoundaryExtractor fieldToCheck​(DslBoundaryExtractor.TargetField fieldToCheck)
        Allows specifying what part of request or response to apply the extractor to.

        When not specified then the extractor will be applied to the response body.

        Parameters:
        fieldToCheck - field to apply the extractor to.
        Returns:
        the extractor for further configuration or usage.
        See Also:
        DslBoundaryExtractor.TargetField