I’ve been interested in trying to bring some form of static code and language analysis to test automation for quite some time and have never found a suitable tool (vendor or open source) for HP QTP, which uses vbs as it development language (for better or for worse).
Recently I found a tool (Test Design Studio), which support this out of the box. Much like the development community this allows automation teams to identify and eliminate technical debt (e.g. cyclometric complexity), while at the same time supporting targeted code reviews and provide training opportunities with the ultimate goal of producing stable and efficient automation code. This also has the benefit of driving consistenancy of implementation and promotes mobility for team members. I would also think that having this process in place would enable goverance around code quality for outsourcing or partnering with an external testing vendor.
Some examples of the built-in rules for langauge analysis:
- Promote use of the ‘Option Explicit’ statement to help enforce language rules
- Cannot make duplicate declarations of variables in the same scope
- Must use the various Exit statements in the proper context
- ‘Select Case’ constructs must have at least one ‘Case’ statement
- Use of ReportEvent for verification purposes is not allowed within the test
- The timeout for the ‘Exist’ method must be explicitly defined and should not exceed 10 seconds
The tool is extensible enough so new new rules can be added, which the vendor is very responsive on. Maybe they will add a framework to do this?
A sample deployment would involve buying 1 license and running the tool across all your ALM qtp assets on a weekly basis. Keeping track of the history will also allow you to identify trends and/or heatmaps.
I have not seen or heard if HP are thinking about this for QTP or UFT roadmap.
Link to vendor