Scripting Tips & Recommendations

There are many different techniques and tricks you can apply to scripting so i felt it would be a good idea to collect everyone’s scripting tips in a thread and keep it up to date.

These tips can be anything from how to record something properly to preparations that makes life easier and everyone is welcome to contribute to this thread.

  • Plan out your test cases before hand so that unknown user flows don’t cause problems when testing
    It is easy when pulling the test data that users with a missing setting is used for example, this can lead to the application wanting them to change their password for the first login or that they get redirected to a page to choose home country. If these aren’t handled it will lead to unexpected status codes that will cause the test to fail with false positives.

  • Proper usage of inner-loops and input-files will allow you to make multiple user flows in one test
    This can help you simulate abandonment rate to use in E-Commerce testing for example as it will allow you design a test that where 90% of all users complete everything up to purchase and only 10% of the users fully completing the purchase. Detailed information on how to achieve this can be found in the ZebraTester User Guide here.

  • When configuring your test ensure that you have think-times that are anchored in reality
    This is something that is commonly missed, a default think time is present and left unchanged in your test-configuration which leads to wrong load being put on your system. Doing the research and using real life think times is always advisable and can usually be taken from your analytics tool, “Average Time on Page” and “Average Session Duration” metrics will be helpful here in verifying your think time per page and total think time for the full test.

  • You can use Firefox or Chrome to create a .har recording to import to ZebraTester
    Under your browser’s Developer Tools > Network then enable persistent or preserve logs before doing the scenario. When finished with the scenario right click the captured data and “Save as HAR…”. Copy over the HAR file into My Tests folder of ZebraTester. Convert HAR file into prxdat file from Project Navigator.

  • Edit responseVerification.dat to match mime types to your static resources.
    ZebraTester only maps the following mime types as static resources by default,
    image/*, *javascript*, text/css, *shockwave-flash*, video/*, image/svg+xml

Do you have any tips that you feel should be here? Post a reply or send me a PM and i will add it to the list.

2 Likes

Here’s some few tips I’ve gathered that will help in getting a successful creation of ZebraTester script. I’ll add more to these as I encounter new methods and tricks later on.

Pre-recording
• Clear browser cookies and cache always before recording.
• You can use Firefox or Chrome to create a .har recording to import to ZebraTester. Under your browser’s Developer Tools > Network then enable persistent or preserve logs before doing the scenario. When finished with the scenario right click the captured data and “Save as HAR…”. Copy over the har file into My Tests folder of ZebraTester. Convert har file into prxdat file from Project Navigator.

SSL related
• Add ZebraTester’s custom cert (root.cer) on the browser’s (or provisioned on the device) trusted certificates.
• When recording and you experience SSL issues, try setting a specific ssl version (e.g. TLS1.2 or other values) to force a ZebraTester to use that version.
• When recording you encounter an iframe you need to bypass security exception (due to ZebraTester’s spoofed cert), try loading that url separately on the same browsing before re-recording.

Post-recording
• Disable content/size verification for images, .js, .css and other static files after recording (you can use the plugin from Recorder Plug-Ins to quickly accomplish this) to prevent unnecessary failures when you run the script.
• Use Var Finder tool to handle most of the values in the recording that changes dynamically. Don’t depend on var finder 100% (especially for values that are lengthy or url encoded) and some vars you need to handle doesn’t show on it at times.
• When assigning a var to an url parameter, try using UTF-8 as encoding.
• Set think time variable as an input field so that you can easily change the value just before runtime.
• You can also create input fields for host name and port especially if you need the script to point to different domains and port at runtime. Make sure to assign them to the appropriate http and https calls.

4 Likes

Thanks @ervin, will grab and add them to the main post. :slight_smile:

1 Like