Parent page: Service Functions – XML (QTP, VBScript)
What is XSL?
The Extensible Stylesheet Language.
An XSL script is a set of transformation instructions used by an engine (often, web browser, but could be any other processing program as well) to produce a new document based on XML input document. The original document remains unchanged.
The output document format can be another XML, HTML, or plane text.
How XSL could be used in test automation?
XML files verification
Manual verification of XML file contents and structure is a very tedious job, and only small-sized files could be tested that way. Implementation of XML parsing script requires time and does remove the need to manually go over comparison logs. Each XML structure to compare will require creation of a separate script.
Having displayed XML-based data records as a structured and color coded tables on a web-page tester can go through a hundreds of records in just a few minutes.
Example. XML verification example
XML log to Web-page report transformation
It’s very convenient to generate and store execution logs in XML format. That could be Test Execution Logs, File Comparison Logs, Data Processing Logs, anything. However, XML tree view is not screen or paper friendly. Producing logs directly in HTML format creates extra maintenance issues.
Using XSL scripts allows transforming XML log files into easily viewable, content-rich, navigation-enhanced, and printer-friendly web-pages. Same XML log could be displayed in a variety of forms (detailed, summary, fail reports, etc) by quickly switching to different XSL templates.
Example. Text File Compare Report example