How to define an effective filter in .Net script

  • KM02529070
  • 23-Aug-2016
  • 23-Aug-2016

This document has not been formally reviewed for accuracy and is provided "as is" for your convenience.

Summary

How to define an effective filter in .Net script

Question

How to define an effective filter in .Net script

Answer

You should use the following guidelines for defining an effective filter. This is valid for all .Net applications you try to record with the .Net protocol:
1. Create a new filter based on one of the built-in environment filters (.Net Remoting, ADO.NET, Enterprise Services, WCF). If you know that the AUT (Application Under Test) does not use ADO.NET, Remoting, WCF, or Enterprise Services, clear that option since unnecessary filters may slow down the recording.
2. Set the Stack Trace option to true for both recording and code generation: Open the Recording Options ( ctrl+f7) and select the Recording node. Enable Debug Options: Stack Trace and Code Generation: Show Stack Trace.
3. Uncheck the option "Ignore all assemblies by default (advanced)".
4. Record your application. Click Start Record ( ctrl + r) to begin and Stop ( ctrl + f5) to end.
5. View the script's steps. If you can determine the business logic from the steps (and apply correlation if necessary), you may not need to create custom filters. If, however, the script is very long or hard to maintain or correlate, you should customize the script's filter.
6. Try to identify the high-level functions that implement client – server communication. You can do this by opening the AUT source files in the ILSpy tool or by viewing a Stack Trace of the script. High level functions lay between GUI functions and system core functions. Usually system functions (low level) begin with System.*.
7. Set the filter to include the relevant methods—you may need to add their assembly beforehand, using the Add Reference button in the Filter Manager.
8. If, as a result of your including a class, your script has many unrelated method calls, try modifying the filter to exclude the irrelevant methods.
9. Exclude all activity which involves GUI elements (i.e. functions that do not generate traffic to the server).
10. If you identify a non-client/server call in your script, exclude its method in the filter.
11. Record the application again. You should always re-record the application after modifying the filter.
12. Repeat these steps until you get a simple script which can be maintained and correlated.
13. After creating an optimal script, turn off the Stack Trace options and regenerate the script. This will improve the performance of subsequent recordings.
We recommend contacting our Professional Services team who could assist you in setting a working filter. Let us know if you decide to use their services or if you have any further questions.