preload

FilterChildElementsByAttrRegEx (QTP, TestComplete, ...

Posted by Albert Gareev on May 15, 2014
0
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Filters parent XML object by removing child XML nodes not matching specified attribute regex value. Implementation Unit Tests ...

FilterChildElementsByAttr (QTP, TestComplete, XML, ...

Posted by Albert Gareev on Apr 23, 2014
0
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Filters parent XML object by removing child XML nodes not matching specified attribute value. Implementation Unit Tests ...

GetChildElementByAttrRegEx (QTP, TestComplete, XML, ...

Posted by Albert Gareev on Apr 15, 2014
0
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Returns child XML node with specified attribute matching specified regex. Implementation Unit Tests ...

AppendChildElements (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Feb 10, 2014
0
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Append all child elements from the list (including their attributes, comments, text nodes) to XML node. Implementation Test Code ...

ChildAttributeValueByName (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Sep 08, 2012
0
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Returns text value of node’s child attribute specified by name. Valid arguments: an XML element node (NODE_ELEMENT type), name of the attribute. If XML node is not defined, returns empty string. Uses private function p_GetXMLElementAttrText, defined within the library (see parent page). Implementation ...

GetTokenByKeyword (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Mar 06, 2012
0
Parent page: Service Functions – String (QTP, VBScript) Description Get token string from the source string. Position is relative, defined by another token-keyword and a number. Implementation ...

GetTokenByNumber (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Mar 05, 2012
0
Parent page: Service Functions – String (QTP, VBScript) Description Get token string from the source string. Position is absolute, defined by number. Implementation ...

Automatic Data Maintenance – Date/Time (Excel)

Posted by Albert Gareev on Jan 08, 2012
0
A few simple Excel macros I use for automatic data maintenance. Date Macro Current date/time =NOW() 9/7/2011 17:57 Date formatted as text =TEXT(NOW(),”mm/dd/yyyy”) 09/07/2011 Future date (5 days from today) =TEXT(NOW()+5,”mm/dd/yyyy”) 09/12/2011 A year 180 days before today =TEXT(YEAR(NOW()-180), “00”) 2011 A month 58 days from today =TEXT(MONTH(NOW()+58), “00”) 11 Year, formatted ...

CopyChildElements (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Dec 08, 2011
0
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Copy all child elements (and attributes, comments, text nodes) from one XML node to another. Implementation Test Code ...

MoveChildElements (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Dec 06, 2011
0
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript)   Description Move all child elements (and attributes, comments, text nodes) from one XML node to another.  Implementation Test Code ...

XMLElementDepth (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Oct 20, 2011
0
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Locate XML node depth within the hierarchy. Valid argument: an XML element node (NODE_ELEMENT type).  Implementation ...

CreateXMLDOMFromString (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Oct 08, 2011
0
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Create XML DOM object by loading source XML from string. If the string is empty or source XML is invalid returns Nothing. Implementation Test Code ...

XMLNodeSet2Dictionary (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Jul 20, 2011
0
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Service Functions – Dictionary (QTP, TestComplete, VBScript) Description For each occurrence of XML node perform conversion to Dictionary, and store all records in indexed Dictionary object. Implementation ...

XMLNode2Dictionary (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Jul 19, 2011
0
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Service Functions – Dictionary (QTP, TestComplete, VBScript) Description Create Dictionary object and populate with data (only direct content – text, comments, CData, and attributes) taken from XML node. Naming convention: @attr_name for attributes; #text_index for text nodes; #comment_index for comment nodes; #cdata_index for CData Section nodes. […] ...

Generating Test Reports: Final Example

Posted by Albert Gareev on Jun 23, 2011
0
Parent page: Generating Test Reports Today I put all examples together.  Here’s our XML record simulating log data of a test session. XML Source The following line <?xml-stylesheet type=”text/xsl” href=”.\LogView4.xsl”?> instructs the web browser to use XSL script for visualization of XML data. Web-page Report And here’s the source code of the script XSL Source […] ...

XML/XSL Transformation: Using Styles

Posted by Albert Gareev on May 25, 2011
0
Parent page: Generating Test Reports Let’s now take the examples from the previous post, and add more style.  Here’s our XML record simulating log data of a test session. XML Source Did you notice the following line? <?xml-stylesheet type=”text/xsl” href=”.\LogView3.xsl”?> This is how we instruct the web browser to use XSL script for visualization of XML data. […] ...

XML/XSL Transformation: Using Sub-Templates

Posted by Albert Gareev on Mar 14, 2011
3
Parent page: Generating Test Reports Today I continue with more complex examples using previously demonstrated XSL parsing nodes grouped into sub-templates. Here’s our XML record simulating log data of a test session. XML Source Note that the structure of XML file is not identical to the previous examples. It has more complexities and dependencies that need […] ...

XML/XSL Transformation: Tree to Table

Posted by Albert Gareev on Mar 04, 2011
1
Parent page: Generating Test Reports Today I present XML Tree to HTML Table transformation example. Here’s our XML record simulating logged test steps. XML Source Did you notice the following line? <?xml-stylesheet type=”text/xsl” href=”.\Tree2Table.xsl”?> This is how we instruct the web browser to use XSL script for visualization of XML data. Web-page Report And here’s […] ...

XML/XSL Transformation: Using Complex Nodes

Posted by Albert Gareev on Mar 03, 2011
0
Parent page: Generating Test Reports Today I present example on dynamically building HTML nodes, with XSL, and from XML data. Here’s our XML record simulating log data of a test session. XML Source Did you notice the following line? <?xml-stylesheet type=”text/xsl” href=”.\LogView1.xsl”?> This is how we instruct the web browser to use XSL script for […] ...

XML/XSL Transformation: Stats Table

Posted by Albert Gareev on Mar 02, 2011
0
Parent page: Generating Test Reports Today I present example of an HTML Table populated with XML data. Here’s our XML record simulating stats data of a test session. XML Source Did you notice the following line? <?xml-stylesheet type=”text/xsl” href=”.\StatsTable.xsl”?> This is how we instruct the web browser to use XSL script for visualization of XML […] ...

How to “Save As” text template

Posted by Albert Gareev on Oct 26, 2010
0
Parent page: Service Functions – System (QTP, VBScript) Question I need to modify text file template (add a few lines) and “Save as”. Answer One of the typical challenges that people face while trying to automate work tasks, is “procedure – result” confusion. Here, the end result* is confused with a way** to do the […] ...

Inserting breaks into text line

Posted by Albert Gareev on Aug 19, 2010
0
Parent page: Service Functions – String (QTP, VBScript) Description Based on the maximum allowed length of  the string (strMsgText) insert space characters. Implementation ...

How to use Dictionary object for storing Excel data ...

Posted by Albert Gareev on Jun 10, 2010
1
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Open worksheet – map cell values to column names. Notes. Heading and trailing space characters are removed To make mapping not case sensitive index is brought to lower case If your spreadsheet allows column name duplication you need to enhance […] ...

How to use test data from a locked Excel Workbook ...

Posted by Albert Gareev on Apr 08, 2010
1
Parent page: Service Functions – Excel (QTP, VBScript) Question The question was asked here. How can I get data from Excel spreadsheet if it is accidentally open? It ruins whole batch execution. While opening manually I can go “read-only” and still access it. Is there any way to read data from an open and locked […] ...

How to check if Excel Workbook is locked

Posted by Albert Gareev on Apr 07, 2010
0
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Check property. ...

How to wrap text line (QTP, VBScript)

Posted by Albert Gareev on Feb 25, 2010
0
Parent page: Service Functions – String (QTP, VBScript) Question The question was asked here. Hi Albert! Can you email me a QTP function that wraps line of text without breaking words? Thank you!  Answer Proper text alignment is important. The whole layout of CSS block or HTML table could be broken if a text line […] ...

How to trim words inside a text line (QTP, VBScript)

Posted by Albert Gareev on Feb 22, 2010
0
Parent page: Service Functions – String (QTP, VBScript) Question The question was asked here. What QTP function i can use to trim inside string? For e.g. “text text text text” – i want only 1 space between. Answer I believe the sample string provided in the question originally contained multiple space characters inside but was […] ...

How to find-replace empty cells (Excel, QTP, VBScript)

Posted by Albert Gareev on Jan 29, 2010
0
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Open worksheet – Loop through data range – close and save the workbook. Note.  In the example below script finds empty cells and assigns zero  to them. Make sure you targeted the worksheet that you need. You can find it […] ...

How to find Excel worksheet by name (QTP, VBScript)

Posted by Albert Gareev on Jan 27, 2010
1
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Loop through worksheets – close and save the workbook. 1. If you know Excel Worksheet name and pretty sure it exists 2. If you don’t know Excel Worksheet name exactly or not sure if it exists ...

How to add (create) Excel macro from QTP

Posted by Albert Gareev on Jan 21, 2010
0
Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM – Open workbook – Retrieve Code Module object – Add new macro 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”. QTP/VBScript source code ...
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.