Visual Studio – Web test Custom Plugins & Extraction Rules

What is web test plug-in ?

The Web performance test plug-in is run one time for every test iteration. In addition, if you override the PreRequest or PostRequest methods in the test plug-in, those request plug-ins will run before or after each request, respectively.

What is Extraction Rule ?

Extraction rules are similar to validation rules, but instead of just verifying data, they will extract the data and store the result in the Web test context.

The idea behind writing custom libraries

The idea is to extend the visual studio web test capability to suit your test conditions and requirements.

Functionalities not exist out of the box

1.Loops using parameter in the terminating value.

2.Get the number of occurrences from the context.

3.Using parameters in the extraction rule index.

Custom Plugins & Extraction Rules examples

Custom Plugins  
Loop Context Plugin  

Custom Extraction Rules  
GetTheNumberOfOccurrences  
RegExpExtractorWithContextIndex

Loop Context Plugin


ConditionRuleContextParameter : the parameter name of the web test loop.  ContextParameterTerminatingValue : the parameter name that holds the terminating value.

Get The Number Of Occurrences

Context Parameter Name : Parameter name which will hold the number of occurrences value.
MyRegularExpression : Regex (pattern) that you want to get its number of occurrences.

Reg ExpExtractor With Context Index

Context Parameter Name : Parameter name which will hold the extracted value.
MyIndex : Parameter name which hold the index value. MyRegularExpression : Regex (pattern) that will be extracted from context.

Code snippets

References

https://msdn.microsoft.com/enus/library/ms243191.aspx
https://msdn.microsoft.com/en-us/library/ms243179.aspx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.