Custom Patterns are used to more reliably create multiple extractors during the process of autocorrelation. Custom Patterns are useful when StresStimulus' built-in autocorrelation misses a rule necessary for your application. Such situations are characterized by the the following circumstances:
After recording a test case, the verify process exposes one or several errors or critical warnings. Manually creating an extractor and one or several parameters rectifies the situation, and verification of your current test case succeeds. However other test cases would likely require similar manual work. To save these efforts you need to create a Custom Pattern.
Creating a custom autocorrelation pattern
1. In the extractor tree or test case tree, double-click the correlation extractor that you created manually.
2. In the extractor editor (a), click Add auto-correlation pattern (b).
3. The Autocorrelation Pattern Editor (c) will appear with the new pattern (d). Its properties (e) will be pre-filled with information from the extractor.
4. The pattern properties are similar to the extractor's properties, except for the following:
- Content-Type: The initial value is the content type of the request, which the extractor used to create the custom pattern. To add multiple content types, separate them with ';' (semicolon ). Wildcards can be used, for example text/* is acceptable. Leave this property blank to not restrict by content-type.
- Page: The initial value is the request path, which the extractor used to create the custom pattern. Wildcards can be used, for example security/*/authenticate is acceptable. Leave blank to not restrict by page path.
5 Click OK to save the Custom Patterns. Now on future recordings, the autocorrelation engine will attempt to apply this pattern to the created extractors and corresponding parameters.
The following are a list of tips that should be followed for creating autocorrelation patterns.
Do not create autocorrelation patterns that are specific to only one test case
Custom Patterns are invoked during the autocorrelation step executed in the test wizard after recording. They do not automatically affect existing test cases. To apply a Custom Pattern to an existing test case, re-run autocorrelation. To do so, start the test wizard, select the autocorrelation step, and click Next.
Custom Patterns do not have an occurrence property. Occurrence for future extractors created from the custom pattern will be determined by StresStimulus' autocorrelation engine. To reduce the likelihood of errors, try to avoid using broad patterns that may appear many times in responses when creating an extractor that is used to create a custom pattern. For example, if the search pattern is a regular expression of a GUID, it will likely find many results, which will make it an unreliable custom pattern. Instead try to apply an elaborate search pattern that can return only the required dynamic value.
Do not create unnecessarily broad custom pattern definitions as they may impact StresStimulus' script designer's efficiency. For example, do not leave Content-Type and Page properties blank. Otherwise, StresStimulus will execute unnecessary search operations to find extractors in all requests, including those that cannot contain them.
- Patterns on top take precedent over ones on the bottom. If more than one pattern captures the same value then the extractor that matches the higher pattern will be created. Move the more specific patterns to the top and more broad patterns to the bottom. To do so, select the custom pattern and hit Move Up / Move Down buttons on the toolbar.