preload

How to enlist Excel VBA macros (QTP, VBScript)

Posted by Albert Gareev on Jan 20, 2010
1
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Retrieve Code Module object – Retrieve Code Block string – Parse the string – close and save the workbook. Notes. For this example let’s assume our target Workbook is stored as “C:\Temp\1.xls”, and our target Code Module is named “Module1”, and ...

How to exchange parameters with Excel VBA function ...

Posted by Albert Gareev on Jan 15, 2010
0
Parent page: Service Functions – Excel (QTP, VBScript) Answers 1. To pass-in parameters to an Excel VBA function A function must be public and belong to a Macro Module. QTP/VBScript source code Excel/VBA function source code 2. To retrieve parameters from an Excel VBA function You need to reserve cells on a worksheet for that purpose. […] ...

How to call Excel VBA function from QTP

Posted by Albert Gareev on Jan 14, 2010
0
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Invoke the function – Catch error – close and save the workbook. Notes. Macro (Sub or Function) must be public and belong to a Macro Module. ...

Service Functions – Excel (QTP, TestComplete, ...

Posted by Albert Gareev on Jan 12, 2010
0
In the code examples I present I often refer to routine functions. In my framework I have specialized libraries to call from.  In my blog I maintain the similar structure. Functions Excel File Worksheet compare (QTP, VBScript) How to check if Excel Workbook is locked A little automation for VBScript OOP (1) A little automation for […] ...

How to update value in XML file (QTP, VBScript)

Posted by Albert Gareev on Dec 30, 2009
0
Parent page: Service Functions – XML (QTP, VBScript)  Answers Description Open XML file – load into memory – locate target nodes – update (replace) values – save XML file (either under a new name or overwrite the original file). Search is performed by tag name (“target_node”). If you pass in a non-string parameter for .SetValue function, convert […] ...

How to count XML nodes (QTP, VBScript)

Posted by Albert Gareev on Dec 29, 2009
1
Parent page: Service Functions – XML (QTP, VBScript)  Answers 1. How to count all direct children? 2. How to count all direct children, specific name tag? 3. How to count all descendants? References Read more about XPath queries. ...

Generating text file from XML template (QTP, VBScript)

Posted by Albert Gareev on Dec 09, 2009
1
Parent page: Service Functions – System (QTP, VBScript) Description If you need to generate text file with values you don’t know ahead you may do it dynamically, by utilizing the function below. Make sure you designed template first. The current logic is oriented to executable text files generation, like Dexterity Macro or OS Shell batch files. Code lines are data-driven, […] ...

Text File Compare Report example (XML, XSL, HTML)

Posted by Albert Gareev on Dec 03, 2009
1
Root page: Service Functions – XML (QTP, VBScript) Parent page: XSL introduction and references Related post: Text File compare in “WDIFF” style (QTP, VBScript, XML, XSL) – Instructions and XSL script Sample task After line by line (and word by word) text file comparison has been performed, XML log was produced. Review the log, identify and report found issues. […] ...

XML verification example (XSL, HTML)

Posted by Albert Gareev on Dec 02, 2009
0
Root page: Service Functions – XML (QTP, VBScript) Parent page: XSL introduction and references Sample task Verify “transactions” xml file consisting of 10-1000 records. Only “debit” or “credit” record names are valid. Any other entries must be located and reported. Additionally, identify and report all debit records with debit amount greater than 50.00 Sample XML As you can […] ...

XSL introduction and references

Posted by Albert Gareev on Nov 30, 2009
1
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 […] ...

XPath introduction and references

Posted by Albert Gareev on Nov 23, 2009
0
Parent page: Service Functions – XML (QTP, VBScript)  Note. Although there could be no “reusable function” that would construct XPath for you, I store current post under “XML Service Functions” category, as it’s closely related to it. XPath is fairly simple to learn and very powerful in use.  You can use free XPath Designer Tool to validate […] ...

QTP-XML service functions (7) – Add processing ...

Posted by Albert Gareev on Nov 15, 2009
0
Parent page: Service Functions – XML (QTP, VBScript) Description This particular example demonstrates adding XSL call that contains instructions transforming XML tree to a web-page (HTML). Built-in QTP support for XML does not provide mapping for XML methods that operate special nodes, like Processing Instructions. It can be done through Microsoft XML DOM object. ...

QTP-XML service functions (6) – ...

Posted by Albert Gareev on Nov 14, 2009
0
Parent page: Service Functions – XML (QTP, VBScript) Description Uses .AddChildElementByName method to create a child XML node, then returns reference to the newly created object. If Parent XML node is not defined returns “Nothing”. ...

How to open Excel workbook (QTP, VBScript)

Posted by Albert Gareev on Oct 17, 2009
0
Parent page: Service Functions – Excel (QTP, VBScript) Description Check the file exists – Create an instance of Excel by using COM – open (load) file ...

Service Functions – XML (QTP, VBScript)

Posted by Albert Gareev on Oct 02, 2009
0
In the code examples I present I often refer to routine functions. In my framework I have specialized libraries to call from.  In my blog I maintain the similar structure.  Using built-in QTP-XML Objects and Functions  Returns reference of XML Element Returns text value of XML Element Returns reference of XML Attribute Returns text value of […] ...

Service Functions – String (QTP, VBScript)

Posted by Albert Gareev on Oct 01, 2009
2
In the code examples I present I often refer to routine functions. In my framework I have specialized libraries to call from.  In my blog I maintain the similar structure. Matching string with a pattern (Regular Expression, RegEx)   Replace pattern(s) in a string Number conversion and initialization with a default value   Initialize string with […] ...

QTP-XML service functions (5) – ChildCommentValue

Posted by Albert Gareev on Jul 21, 2009
0
Parent page: Service Functions – XML (QTP, VBScript) Description Retrieves child comment node from comments collection and returns comment text as string. ...

QTP-XML service functions (4) – ...

Posted by Albert Gareev on Jul 17, 2009
0
Parent page:  Service Functions – XML (QTP, VBScript)  Description Returns scalar value of the XML child attribute specified by a name. Attribute name duplication within the same node is not allowed by XML rules. If there is no attribute with the name specified then “” (empty string) is returned. ...

QTP-XML service functions (3) – ChildAttributeByName

Posted by Albert Gareev on Jul 16, 2009
0
Parent page: Service Functions – XML (QTP, VBScript)  Description Returns XML child attribute (as XMLAttribute object reference) specified by a name. Attribute name duplication within the same node is not allowed by XML rules. If there is no attribute with the name specified then “Nothing” is returned. ...

QTP-XML service functions (2) – ...

Posted by Albert Gareev on Jul 15, 2009
0
Parent page:  Service Functions – XML (QTP, VBScript)  Description Returns scalar value of the XML child node specified by an xml tag name. If there are multiple objects with the same tag, returns value of the first reference. If there are no objects with the tag specified returns “” (empty string). ...

QTP-XML service functions (1) – ...

Posted by Albert Gareev on Jul 14, 2009
0
Parent page: Service Functions – XML (QTP, VBScript) Description Returns XML child node (as XMLElement object reference) specified by an xml tag name. If there are multiple objects with the same tag, returns the first reference. If there are no objects with the tag specified returns “Nothing”. ...

Text File compare in “WDIFF” style (QTP, ...

Posted by Albert Gareev on May 27, 2009
0
Original date: N/A The post has been mostly recompiled from the comments. Displaying Text File comparison results in an embedded report. Refer to Text File Compare functions used to see how XML file is generated. Sample requirements to show comparison results stored in XML as a web-page (HTML). 1. Show file stats saved in xml file. […] ...

Text File compare in “WDIFF” style (QTP, ...

Posted by Albert Gareev on May 26, 2009
2
Original date: 26 Jan 2009, 1:30pm Line by line, and word by word comparison isn’t a big problem. But how conveniently show the results? With WinRunner comparison and reporting has been implemented utilizing WDIFF program. With QTP we can do the same using XML-XSL technology. The function below performs comparison of 2 text files generating […] ...

Excel File Worksheet compare (QTP, VBScript)

Posted by Albert Gareev on May 25, 2009
0
Original date: 19 Jan 2009, 2:00pm Parent page: Service Functions – Excel (QTP, VBScript) Excel application must be installed on the PC. Comparison goes cell by cell within the occupied range. Marks mismatching cells red. Both workbooks must exist and be defined as the full path with file. Both worksheets must exist and may be […] ...

Mapping Excel col names (QTP, VBScript)

Posted by Albert Gareev on May 23, 2009
1
Original date: 5 Dec 2008, 1:23pm Parent page: Service Functions – Excel (QTP, VBScript) ...

AssociateRecords (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Jan 23, 2009
0
Parent page: Service Functions – Dictionary (QTP, TestComplete, VBScript) Description Converts a string of comma-separated sets of parameters. Example: “User1 {login=john_doe, password=john1}, User2 {login=jane_doe, password=jane1}” Implementation ...

Clone/Copy/Release Dictionary Parameters (QTP, ...

Posted by Albert Gareev on Jan 14, 2009
0
Parent page: Service Functions – Dictionary (QTP, TestComplete, VBScript) Description 1. Clone Dictionary object with all parameters 2. Copy parameters from one Dictionary to another 3. Release objects associated to Dictionary keys Implementation CloneParameters CopyParameters  ReleaseParameters ...

Service Functions – Dictionary (QTP, TestComplete, ...

Posted by Albert Gareev on Jan 09, 2009
0
In the code examples I present I often refer to routine functions. In my framework I have specialized libraries to call from.  In my blog I maintain the similar structure.  Basic Operations AssociateParameters (QTP, TestComplete, VBScript) ParametersToStr (QTP, TestComplete, VBScript) Clone/Copy/Release Dictionary Parameters (QTP, TestComplete, VBScript) Advanced Structures AssociateRecords (QTP, TestComplete, VBScript) Mapping Excel col ...

ParametersToStr (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Jan 03, 2009
0
Parent page: Service Functions – Dictionary (QTP, TestComplete, VBScript) Description Does exactly opposite what AssociateParameters does – converts a Dictionary back to the string of pairs. Special characters are treated. Implementation ...

AssociateParameters (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Jan 02, 2009
0
Parent page: Service Functions – Dictionary (QTP, TestComplete, VBScript) Description Converts a string of comma-separated pairs “a=1, b=2, c = 3” to a Dictionary object. Spaces will be trimmed. Special characters: “=”  “,” – can be escaped with backslash. Replace special characters in the string  – associate pairs – replace characters back. Implementation ...
Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.