Monday, March 17, 2014

Message Box closes automatically using windows shell

Dim msg
msg = “Message Box automatically close in 5 second”
Set oShell = CreateObject(“WScript.Shell”)
oShell.Popup msg,10, “QTP Challenges”
In above statement, there are three arguments -
msg – the content/string of the message box
10 – the time in seconds
“QTP  Challenges” – the title of the message box

QTP Mercury Device Replay

In Order to use the DeviceReplay methods, you need to create DeviceReplay object.
Set objDeviceReplay = CreateObject(“Mercury.DeviceReplay”)
We use SendKeys method to send keyboard input/keystrokes to applications that dont have automation interface. We can also send more than one keystroke at a time using Sendkeys method. To send keystrokes x,y and z, you would send the string argument “xyz”.
Note: You cannot send Print Screen key to an application.
So, the difference between Mercury DeviceReplay and Sendkeys is
SendKeys -> Support only Keyboard Operations
DeviceReplay-> Support Keyboard + Mouse Operations like Drag Drop too.
In addition to that DeviceReplay supports sending multilingual characters and symbols, while sendkeys support limited keyboard operations.
The other operational difference is dependency on QTP software.
Mercury.DeviceReplay :- It comes with QTP as a module, so you need QTP on the system and only from QTP action you can use it.
SendKeys :- It could be used in VBS script to simulate keyboard inputs with native windows shell commands. It has no dependency on QTP as such.
Mercury DeviceReplay is a powerful utility to simulate keyboard input and also for simulating mouse clicks and movements. Under Java Add-in, you can find the DeviceReplay property. At times, Object.Set and Object.Type doesnt help in QTP for some applications. You can use Mercury DeviceReplay to type Non English symbols and letters even without changing the keyboard layout or installing the special fonts.
Methods
  1. MouseMove x, y                           {Move the mouse to the screen coordinate (x,y).}
  2. MouseClick x, y, button           {Move the mouse to the screen coordinate (x,y) and click the button}(0=left; 1=middle; 2=right).
  3. MouseDblClick x, y, button    {Move the mouse to the screen coordinate (x,y) and double-click the button}(0=left; 1=middle; 2=right).
  4. DragAndDrop x, y, dropx, dropy, button       {Drag the mouse from screen coordinate (x,y) to (dropx,dropy) with the button}(0=left; 1=middle; 2=right) pressed.
  5. PressKey key      {Press a key using the ASCII code of the key.}For example, Chr(13), vbCR and vbTab.
  6. MouseDown x, y, button    { Press the mouse button on screen coordinate (x,y).}
  7. MouseUp x, y, button     {Release the mouse button on screen coordinate (x,y).}
  8. KeyDown key                       {Press a key using the ASCII code of the key.}For example, Chr(13), vbCR and vbTab.
  9. KeyUp key                           {Release a key using the ASCII code of the key.}For example, Chr(13), vbCR and vbTab.
  10. SendString string             {Type a string.}

Web Automation Testing Tools

Web Testing Tools

RedBot - An open source robot that checks HTTP resources to see how they’ll behave, pointing out common problems and suggesting improvements. Although it is not a HTTP conformance tester, it can find a number of HTTP-related issues. Interacts with the resource at the provided URL to check for a large number of common HTTP problems, including: Invalid syntax in headers, ill-formed messages (e.g., bad chunking, incorrect content-length), incorrect gzip encoding, missing headers. Additionally, it will tell how well your resource supports such HTTP features as caching, negotiation for compression, last-Modified and ETag validation, partial content. Supports http but not https.

Webpagetest - A tool that was orginially developed by AOL for use internally and was open-sourced in 2008. The online version atwww.webpagetest.org is an industry collaboration with various companies providing the testing infrastructure for testing your site from across the globe. Provides web page content analysis, performance analysis, various performance scores. API’s availabel for scripting.

Page Speed - An open-source project started at Google to help developers optimize their web pages by applying web performance best practices. Started as an open-source Firefox/Firebug add-on and is now deployed in third-party products such as Webpagetest.org, Show Slow and Google Webmaster Tools. Page Speed family of tools includes Page Speed Firefox/Firebug add-on which allows you to evaluate the performance of web pages and to get suggestions on how to improve them, and the mod_pagespeed Apache module which automatically rewrites pages and resources to improve their performance.

Speed Tracer - An open source tool to help you identify and fix performance problems in your web applications. It visualizes metrics that are taken from low level instrumentation points inside of the browser and analyzes them as your application runs. Speed Tracer is available as a Chrome extension and works on all platforms where extensions are currently supported (Windows and Linux). Using Speed Tracer you are able to get a better picture of where time is being spent in your application. This includes problems caused by JavaScript parsing and execution, layout, CSS style recalculation and selector matching, DOM event handling, network resource loading, timer fires, XMLHttpRequest callbacks, painting, and more.

ShowSlow - An open source tool that helps monitor various website performance metrics over time by collecting web performance data and showing it in aggregated form for better business understanding. Captures the results of YSlow and Page Speed rankings and graphs them, to help you understand how various changes to your site affect its performance.

Blaze - An online service from From Blaze Software Inc. for optimizing website speed by optimizing Front End Performance. Blaze’s automated optimization combined with it’s Content Delivery Network partner can maximize the potential performance of your web site.

Fitnium - Fitnium from Magneticreason.com provides the ability to write and execute Selenium tests using the
FitNesse framework but without the need to write code. Based on a FitNesse DoFixture, provides an English language interpretation of the Selenium API that you would normally call from Java, Ruby, Python, Perl or C#. In this instance it allows developers, testers, and customers to write UI driven automated acceptance tests. All API’s available to Java, Ruby, Python, Perl or C# developers is now available as an easily understand English phrase that anyone can use to develop their own tests.

Sauce OnDemand - Runs Selenium tests in parallel across multiple browsers in the cloud; from SauceLabs Inc. Acts as a drop-in replacement for Selenium RC, allowing simple configuring of scripts to use Sauce OnDemand. Unlimited browser instances enables testing as many apps across as many browsers as needed; live remote control views of tests running in Sauce OnDemand enables faster test debugging cycles; run FireFox Custom Profiles in the Cloud; test apps securely behind a firewall with Sauce Tunnel – connects a VM on your internal webserver to Sauce OnDemand via SSH, with only the Sauce Labs machines actively running the tests having access and when a test is finished, access is revoked.

JSView - Firefox plugin enables ability to view the source code of external files. Most websites store their javascripts and style sheets in external files and then link to them within a web page’s source code. JSView enables access to these files from the context menu, from the toolbar, from the view menu, or from the status bar. If the website you are viewing contains any external js/css files, an icon will appear that says “SS”, “JS”, or both. Each individual file can then be viewed by clicking on the filename. The file will be opened in a new window. You can also choose to open all external files by clicking on “View All”.

Flash-Selenium - The Flash-selenium open source project extends the Selenium RC clients for adding Flash communication capabilities. Enables direct testing of the UI components of a Flex application.

Selenium-Flex API - The Selenium-Flex API allows automation of Flex applications using the popular test automation tool Selenium. The API is easy to set up and can be done with only basic working knowledge of either Flex or Selenium. Requires Firefox and inclusion of the Selenium-Flex API in Flex app build.

Virtu-El.com Spell Checker Online free spell checker and link checker from C# computing.

HTTPDebugger - HTTP Traffic Analyzer tool from MadeForNet.com that enable effective debugging of http headers and http content. Analyze HTTP headers, POST data, cookies, error codes and SOAP envelopes; measure the size, execution and downloading time of dynamic web pages; view the traffic from browser add-ons, ActiveX components and Java applets; decode HTTPS connections and gzip/chunked encodings; see complete stats in charts and diagrams. Supports a variety of browsers.

WebWait - Free online web site timer from Michael Mahemof; use to benchmark your website or test the speed of your web connection; pulls down the entire website into your browser, so it takes into account Ajax/Javascript processing and image loading which other tools ignore.

Cucumber - Cucumber is a tool that can execute plain-text functional descriptions as automated tests. The language that Cucumber understands is called Gherkin. While Cucumber can be thought of as a “testing” tool, the intent of the tool is to support BDD (Behavior-Driven Development). This means that the “tests” (plain text feature descriptions with scenarios) are typically written before anything else and verified by business analysts, domain experts, etc. non technical stakeholders. The production code is then written outside-in, to make the stories pass. Cucumber itself is written in Ruby, but it can be used to “test” code written in Ruby or other languages including but not limited to Java, C# and Python. Requires only minimal use of Ruby scripting, so cucumber can be utilized in testing contexts where the application code is not Ruby.

Aptimize Website Accelerator - An ISAPI filter for Microsoft IIS, or a Daemon and module for Linux Apache, that automates performance tuning by dynamically optimizing web pages for high performance at runtime – just before a page is sent from web server to browser. For Win and Linux platforms.

Spello - Open source web site spell checker; run as a windows form or command line. Supports English (US and UK), French, German and Spanish (Spain and Mexico) dictionaries. More dictionaries can be downloaded from http://wiki.services.openoffice.org/wiki/Dictionaries. Html based log file. Written in C#, requires Microsoft.Net 3.5 SP1, the setup program has a bootstrapper to install it.

eggPlant - An image-based, low-overhead, non-invasive black-box test automation tool. Does not reside on the system-under-test and is technology agnostic, so it can test in many situations that other tools cannot by using image capture and advanced search techniques. Does not interact with the underlying code, and can test any application including those that can cause problems for other tools such as Flash, Silverlight, etc. Works

T-Plan Robot - A black box automated testing tool developed on generic image based testing principles; provides a human-like approach to software testing and performs in situations where other tools may fail. Support of Java test scripts as well as a proprietary scripting language; record & replay capability; support of testing over the RFB protocol (better known as VNC); ability to perform black box GUI testing of mobile phones (Windows Mobile, Symbian, iPhone); open architecture with a generic plugin interface and well documented programming interfaces. Platform independent (Java); runs on, and automates major systems, such as Windows, Linux, Unix, Solaris and certain mobile platforms.

Browsershots - Free online cross browser/OS comparison testing. Choose browser OS, browser, and versions of interest and submit URL and site responds with a collection of screen shots.

Multi-Browser Viewer - Cross browser testing solution from TWD Solutions Pte Ltd. includes a wide variety of standalone virtualized browsers, multiple standalone mobile browsers or simulators, 58 screen capture image browsers; Screenshot comparison function (“Onion Skin” or “Side-by-Side”); available in multiple languages.

IE collection at Final Builds site - Enables installing standalone IE browser versions for comparison/testing, MS IE versions 1.0 thru 8.0.

BrowserSeal - Multi browser website screenshot tool – capture an image of web site under multiple browsers Supports multiple versions of IE, Firefox, Google Chrome, Opera, Safari. Optimized for speed. Comes with standalone versions of all major browsers to verify site layout issues and troubleshoot functionality issues. The Automated edition adds the ability to automaitcally capture miltuple URLs without user intervention, and command-line control enabling use in automation scripts. For Windows platforms.

LiteTest - Web analysis and evaluation reports of your website usability and other aspects; you test other users websites, and they test yours. Complete a website evaluation report for three other sites and you will then be guaranteed a minimum of three web analysis reports on your own site. Registration and evaluations are free.

System Shephard - An IT Performance Monitoring and Operations Management Platform for web and other systems; from Absolute Performance Inc. Modules include StressWalk and WebWalk. Delivers an enterprise-wide view of system performance and alert status; supplies analysis and reports based on real-time, recent, and historical data

Spydermate - Free online SEO analysis tool from MentorMate that gives a numerical and visual representation of a website’s online marketing effort by using a variety of graphs and statistics. Other capabilities: page-specific on-site keyword analysis; side-by-side comparisons of your own website against a competitor.

Twill - Simple open source Python-based scripting language for web browser control from a command-line interface. Navigate through Web sites that use forms, cookies, and most standard Web features. Supports automated Web testing

Firefox Web Testing Add-ons - Includes many tools that can be useful for testing such as iMacros for Firefox, WASP, Fireshot, Window Resizer, Selenium IDE, Web Developer, SwitchProxy, IE Tab, Molybdenum, HackBar, and many more.

Web Testing Plugin collection - Large collection of links to and short descriptions of open source utilities and tools for web testing, unit testing, assertions, mocks, fixture utilities, reporting, validators, code coverage, etc. Mostly for Ruby, maintained by Benjamin Curtis

UTE - Automated ‘usability testing environment’ from Mind Design Systems, Inc. Assists in quantitative usability evaluation of websites and web applications; automates capture of usability data in detail not easily done by a human observer. Consists of a) a ‘UTE Manager’ which helps set up test scenarios (tasks) as well as survey and demographic questions, and compiles results and produces customized reports and summary data; and b) a ‘UTE Runner’ which presents test participants with test scenarios (tasks) as well as any demographic and survey questions; the runner also tracks actions of the subject throughout the test including clicks, keystrokes, and scrolling.

Venkman Javascript Debugger - Firefox extension; open source JavaScript debugging environment for Mozilla based browsers.

XPather Firefox add-on by Viktor Zigo. Has rich XPath generator, editor, inspector and simple extraction tool. Requires the standard DOM inspector plugin for FF3.

FlexMonkey - A testing framework for Flex apps. Capabilities include capture, replay and verification of Flex UI functionality. Can generate ActionScript-based testing scripts that can easily be included within a continuous integration process. Uses the Flex Automation API and was created by extending Adobe’s sample automation adapter, AutoQuick. Donated to the Flex community by Gorilla Logic. Site also lists info and links to three other open source Flex test tools/frameworks: FlexUnit, Selenium-Flex, and FunFx.

UnmaskParasites - A free online service that checks web pages for hidden illicit content (invisible spam links, iframes, malicious scripts and redirects). By Denis Sinegubko. Just type in the URL of the web site to be checked.

TestArmy - TestArmy provides cheap access to a large, flexible base of testers with a wide range of hardware. Test applications thoroughly in a variety of environments, at lower cost, using crowd-sourcing. Enable more efficient testing on the end user hardware and software platforms that have proliferated, particularly for mobile and web applications. Developed by Peter Georgeson.

Rasta - Rasta is a keyword-driven open source test framework by Hugh McGowan using spreadsheets to drive testing. Loosely based on FIT, where data tables define parameters and expected results. The spreadsheet can then be parsed using your test fixtures. For the underlying test harness, Rasta uses RSpec so in addition to reporting results back to the spreadsheet you can take advantage of RSpec’s output formatters and simultaneously export into other formats such as HTML and plain text. Since Rasta utilizes Ruby, it can work well with Watir (listed elsewhere in this page).

File Comparators - Web testing – or any type of testing – often involves verification of data vs expected data. While this is simple enough programmatically for single data points or small data sets, comparison of large amounts of data can be more challenging. This site, maintained by FolderMatch/Salty Brine Software, a windows file/folder comparator tool vendor, lists a large number of Win data comparators. An old (2003) but still useful listing of mostly non-Windows data comparator tools is maintained by Danny Faught in his Open Testware Reviews site’s Data Comparator Survey .

TMX - Keyword driven test automation product from Critical Logic, provides automated, fully annotated, executable scripts for QTPro, Watir, TestPartner, and SilkTest. Imports the objects that make up an application (radio buttons, entry fields, etc.) and builds an Object Tree containing all elements and attributes subject to testing. Then automatically generates the executable test scripts and test documentation. ‘Virtual Objects’ allow building of test scripts from requirements in parallel with code development.

Google’s Website Optimizer - Google’s service for testing variations in site design (titles, images, content, etc) to determine impacts on conversions, user actions, traffic, or other goals.

YSlow - Free open source tool analyzes web pages and explains why they’re slow based on rules for high performance web sites. A Firefox add-on integrated with the Firebug web development tool. Includes a Performance report card, HTTP/HTML summary, list of components in page and related info, tools including JSLint. Generates a grade for each rule and an overall grade, lists suggested specific changes to improve performance, calculates total size of page for empty and primed cache scenarios, cookie info. Can also view HTTP response headers for any component.

ItsNat - Open source Java AJAX component-based web development framework provides a natural approach to web development; leverages ‘old’ tools to build new AJAX based Web 2.0 applications. Server centric using an approach called TBITS, “The Browser Is The Server”: simulates a Universal W3C Java Browser at the server mimicing the behavior of a web browser, containing a W3C DOM Level 2 node tree and receiving W3C DOM Events. Contains significant built in functional web test support.

HTT - Open source scriptable HTTP test tool for testing and benchmarking web apps and for HTTP server development. Can act as client (requesting) and server (backend for reverse proxys). Pattern matching answers (both server and client) to test validity. Supports chunking in request and response.

Web Page Analyzer - Free online website performance tool and page speed analysis from Website Optimization. Calculate page size, composition, and download time., size of individual elements and sums up each type of web page component. Then offers advice on improving page load time.

HTTPWatch - An HTTP viewer and debugger plugin for MS Internet Explorer for HTTP and HTTPS monitoring without leaving browser window. Real-time page and request level time charts;millisecond accurate timings and network level data. Includes automation interface that can be used by most programming languages. Supports filtering of requests by criteria such as content types, response codes, URLs, headers and content. Basic free and paid versions available.

IBM Rational Policy Tester Accessibility Edition - Helps ensure Web site accessibility to all users by monitoring for over 170 comprehensive accessibility checks. It helps determine the site’s level of compliance with government standards, including the U.S. government’s Section 508 and guidelines such as the World Wide Web Consortium’s Web Content Accessibility Guidelines (W3C WCAG), the UK’s Disability Discrimination Act, and France’s AccessiWeb.

IBM Rational Policy Tester Privacy Edition - Reports on form, form controls, and Form GET inventory, pages collecting Personally Identifiable Information (PII) and privacy policy links. Generates inventory of site privacy policies and checks and checks for secure pages and encryption and third-party data sharing policies; maps technical checks to specific online requirements of laws and regulations, such as U.S. Children’s Online Privacy Protection Act (COPPA), Gramm-Leach-Bliley Act (GLBA) Privacy Rules, HIPAA, California SB1386 & AB1950 and AB1 950; Safe Harbor re European Community’s Directive on Data Protection; and U.S. Section 208.

TextTrust - Online service for one time or periodic full site spell checking; report includes listing of each text error with URL, built-in spelling mistake highlighter; correct your errors with Google suggestion lookup. System learns as it checks, detects industry terms and buzzwords such that only real errors are reported.

WireShark - Network protocol analyzer available under the GNU General Public License. Capabilities include deep inspection of hundreds of protocols, live capture and offline analysis, standard three-pane packet browser, runs on most platforms. Captured network data can be browsed via a GUI, or via the TTY-mode TShark utility; rich VoIP analysis; read/write a very wide variety of different capture file formats. Live data can be read from Ethernet, IEEE 802.11, PPP/HDLC, ATM, Bluetooth, USB, Token Ring, Frame Relay, FDDI, and others. Decryption support for many protocols, including IPsec, ISAKMP, Kerberos, SNMPv3, SSL/TLS, WEP, and WPA/WPA2. Coloring rules can be applied to the packet list for quick, intuitive analysis. Output can be exported to XML, PostScript, CSV, or plain text

TPTest - An open source software suite for testing network throughput and Internet services. It consists of a software library with test functions that can be implemented in test client and server applications. Reference client/server apps are also included.

BWMeter - Bandwidth meter, monitor and traffic controller, which measures, displays and controls all traffic to/from computer(s) or on your network. Can analyze the data packets (where they come from, where they go, which port and protocol they use). For Windows platforms. Shareware.

Fiddler - HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and “fiddle” with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language. Can debug traffic from virtually any application. For Windows platforms. Freeware.

HTTP Interceptor - Low cost pseudo Proxy server that performs http diagnostics and enables viewing of the two way communication between browser and the Internet. View http, asp, http header, data headers, responses. Demo version Free and paid versions available.

Expecco - A component based, modular test and quality assurance platform from eXept Software AG, which aims at the consolidation of tests and partial test systems into an automated, interactive test center. Enables productivity improvement in creation and maintenance of test scenarios, includes extensive debug features and flexible integration into existing enterprises. Features include utilization of UML 2.0 and Selenium libraries.

Aptixia IxLoad - Highly scalable, integrated test solution from Ixia Inc. for assessing the performance of Triple Play (Voice, Video and Data services) networks and devices. IxLoad emulates IPTV and Triple Play subscribers and associated protocols to ensure subscriber Quality of Experience (QoE). Protocols supported include video protocols like IGMP, MLD, and RTSP; voice protocols like SIP and MGCP; and data protocols like HTTP, FTP, and SMTP. Can be used to test critical aspects of the infrastructure like DNS, DHCP, RADIUS, and LDAP services, as well generate malicious traffic to test for security. Also available are a wide variety of other related performance test tools to help accelerate the migration of communications and entertainment to IP.

Internet Explorer Developer Toolbar - Microsoft add-on for IE that includes some tools for that can be useful for web testing. Includes tools to explore a page’s document object model (DOM), locate and select specific elements on a Web page through a variety of techniques, view HTML object class names, ID’s, and details such as link paths, tab index values, and access keys; validate HTML, CSS, WAI, and RSS web feed links; view the formatted and syntax colored source of HTML and CSS; and more.

Web Service Scheduler - WSS is an online cron service that can execute custom scripts remotely, for websites hosted on a web server with no access to a scheduling utility like cron or task scheduler. To use, just login and add the URL of the web service or script (PHP, ASP, CGI) and the time you would like the service to run. Basic account is free.

Chickenfoot - An open source Firefox extension from MIT that creates a programming environment in the Firefox sidebar, enables wrting of scripts to manipulate web pages and automate web browsing. Scripts are written in a superset of Javascript that includes special functions specific to web tasks.

WebAii - Free web automation framework from Telerik that helps developers easily write functional tests for AJAX and Silverlight applications. The framework offers one consistent API that allows users to automate the UI of web applications as part of regression testing. Besides Silverlight support, a key benefit of WebAii Testing Framework is the browser abstraction, which allows developers to create a test once and execute it against all major browsers – IE, FF, and Safari for Windows are currently supported.

sketchPath - Free XPath Editor and XML analysis and testing tool by Phil Fearon supporting XPath 1.0 and 2.0. Capabilities includes: Provides integrated graphical environment for viewing XML files, developing and testing XPath expressions against them and managing the expressions in file libraries. Auto-Generate XPath locations by selecting from XPath result list, regular expression result list, element tree view, element nodes list, XML text editor, etc. Import XPath Expressions from an XML source (eg. XSLT). auto-complete uses ‘Look-Ahead’ to list available location and value nodes when typing, XSD schema validation with fully-navigable invalid elements list. Use regular expressions to resolve XPath locations. And more. For Windows platforms.

soapUI - A free, open source desktop application from Eviware Software AB for inspecting, invoking, developing, simulating/mocking and functional/load/compliance testing of web services over HTTP. It is mainly aimed at developers/testers providing and/or consuming web services (java, .net, etc). Functional and Load-Testing can be done both interactively in soapUI or within an automated build/integration process using the soapUI command-line tools. Mock Web Services can be created for any WSDL and hosted from within soapUI or using the command-line MockService runner. IDE-plugins available for eclipse, IntelliJ IDEA, NetBeans and a specialized eclipse-plugin for JBossWS. Paid ‘pro’ version available with professional support and extended functionality.

SOAPscope Server - Web services test tool from Mindreef Inc./Progress Software; create test scenarios automatically by recording actions; share these with other testers in collaborative server-baaed UI. View WSDL and SOAP messages in Pseudocode ViewTM. Create complex tests including passing values from a response to subsequent requests, perform batch testing and validate results all without coding. Simulate web services that don’t yet exist, or new scenarios for those that do.

Parasoft SOAtest - Scriptless web services test tool from Parasoft. Automatic test creation from WSDL, WSIL, UDDI and HTTP Traffic. Capabilities include WSDL validation, load and performance testing; graphically model and test complex scenarios. Automatically creates security penetration tests for SQL injections, XPath injections, parameter fuzzing, XML bombs, and external entities. Data-driven testing through data sources such as Excel, CSV, DB queries, etc. Support for JMS; MIME attachment support.

QEngine - ManageEngine QEngine Web Service Functional Test tool automates functional testing of web services that are bound with the SOAP/HTTP binding. Automatically generates test scripts from a WSDL document and validates every operation published in the WSDL document. The responses to each SOAP/HTTP request can be validated against the data sources such as CSV or Database.

Fault Factory - API-level fault injection tool from from Extradata Technologies; injects HTTP/SOAP/Socket faults into an application – no code changes, no proxies required. Injects two types of faults: socket API failures and arbitrary HTTP responses (that can be used to imitate a wide range of conditions, including SOAP faults). Can be used standalone or in combination with a debugger. Language-neutral. For Windows platforms.

XML-Simulator - Black-box test tool from Elvior for applications using asynchronous XML messaging to communicate with different systems. Customizable to support any XML protocol.

Tools4Internet - Free on-the-web tools for determination/testing of various web page/site characteristics; results presented in convenient tabbed summary format. Includes browser/server security information tool for viewing details of http headers sent from web server and browser, along with other information obtainable via javascript and other publicly available means. Web Content Analysis capability includes response time, web page code comments lines, anchors, scripts, etc.

Firebug - Open source add-on tool for Firefox – allows editing, debugging, and monitoring of CSS, HTML, and JavaScript live in any web page. Monitor network activity, visualize CSS metrics, information about errors in JavaScript, CSS, and XML. Includes DOM explorer; execute JavaScript on the fly.

GH Tester - Middleware test automation tool, from Green Hat Consulting Limited, for testing systems that do not have graphical user interfaces including web services, JMS, IBM MQ, Sonic MQ, TIBCO, TCP/IP, UDP/IP and SmartSockets. Includes an API enabling writing of your own transports. Schema-aware message editors for XML (DTD and XSD), SOAP (WSDL) and AE. Other capabilities: automatically create test plan documentation, record and playback messages, integrate with databases to simulate adapters by querying or changing rows, produce detailed reports on actual test results and expectations, including any differences

Filemon - Free tool from Microsoft monitors and displays Windows file system activity on a system in real-time. Timestamping feature shows when every open, read, write or delete, happens, and its status column indicates outcome. Useful in security testing, monitoring/testing of web servers etc. Also available (links available on Filemon page): RegMon – a Registry monitor; Process Monitor – a process and thread monitor; DiskMon – a hard disk monitor.

AceLive - Tool from OpNet Technologies Inc. for end-user experience monitoring and application performance management. Spans network monitoring, measurement, and detection of SLA violations, and can bridges seamlessly into integrated and detailed transaction-level troubleshooting with OPNET’s ACE Analyst.

Charles - An HTTP proxy/monitor/Reverse Proxy that enables viewing all HTTP traffic between browser and the Internet, including requests, responses and HTTP headers (which contain the cookies and caching information). Capabilities include HTTP/SSL and variable modem speed simulation. Useful for XML development in web browsers, such as AJAX (Asynchronous Javascript and XML) and XMLHTTP, as it enables viewing of actual XML between the client and the server. Can autoconfigure browser’s proxy settings on MSIE, Firefox, Safari. Java application from XK72 Ltd.

Paessler Site Inspector - A web browser that combines MSIE and Mozilla/Gecko into one program; it’s Analyzing Browser allows switching between the two browser engines with the click of a mouse to compare. Freeware.

CookiePie Firefox Extension - Firefox extension from Sebastian Wain enabling maintenance of different cookies in different tabs and windows. For example developers working on web software supporting multiple users or profiles can use CookiePie to simultaneusly test their software with each user without needing to open a different browser.

Broken Link Preventer - Link checker that reports on broken links, reports statistics on user attempts to access broken links, and enables broken link prevention. Runs on server and constantly monitors site links.

JsUnit - An open-source unit testing framework for client-side (in-browser) JavaScript in the tradition of the XUnit frameworks

Web Performance Advanced Server Analysis - Add-on module for the Web Performance Inc. Load Tester tool from Web Performance Inc. Automatically points out performance problems in your operating system or application server; tracks performance counters in the operating system or application server during a load test, marking those statistics that are obviously out of spec so you can quickly identify obvious performance problems. Statistics can be viewed during the test and reviewed later in reports for more detailed analysis.

Eclipse TPTP Testing Tools Project - TPTP (Test & Performance Tools Platform) is a subproject of Eclipse, an open platform for tool integration. TPTP provides frameworks for building testing tools by extending the TPTP Platform. The framework contains testing editors, deployment and execution of tests, execution environments and associated execution history analysis and reporting. The project also includes exemplary tools for JUnit based component testing tool, Web application performance testing tool, and a manual testing tool. The project supports the OMG UML2 Test Profile.

Test Architect - Keyword-driven test automation tool from LogiGear helps increase test coverage. Built-in
playback support for web-based application and other platforms.

Networking and Server Test Utilities - Small collection of web server and other test utilities provided by
hq42.net.

Morae - Usability test tool for web sites and software, from TechSmith Corp. for automated recording, analyzing and sharing of usability data. Consists of 3 components. A Recorder records and synchronizes video and data, creating a digital record of system activity and user interaction. A Remote Viewer enables geographically dispersed observers to watch usability tests from any location; it displays test user’s computer screen along with a picture-in-picture window displaying the test participant’s face and audio; Remote Viewer observers can set markers and add text notes. The Manager component includes integrated editing functionality for assembly of important video clips to share with stakeholders.

AutoTestFlash - Freeware tool by Tiago Simoes for recording and playing back UI Tests in flash applications. Source code also available.

Repro - Manual testing ‘helper’ tool that records desktop video, system operations in 7 different categories, system resource usage, and system configuration information. Allows user to save and review relevant information for bug reports, and compress the result into a very small file to replay, upload to a bug tracking system, and share with others. Instruments in memory the target application at runtime so no changes are required to application under test. For Windows.

TestGen - Free open-source web test data generation program that allows developers to quickly generate test data for their web-services before publicly or internally releasing the web service for production.

EngineViewer and SiteTimer - Free basic services: EngineViewer – reports on how a search engine may view a webpage, from how it breaks down the HTML, to which links it extracts, how it interprets page’s robot exclusion rules and more. SiteTimer service – Find out how long it takes various connection types to get a page, check all the graphical links to ensure they’re correct, examine server’s HTTP headers, more.

Fiddler - An HTTP Debugging tool by Eric Lawrence. Acts as an HTTP Proxy running on port 8888 of local PC. Any application which accepts an HTTP Proxy can be configured to run through Fiddler. Logs all HTTP traffic between between computer and the Internet, and allows inspection of the HTTP data, set breakpoints, and “fiddle” with incoming or outgoing data. Designed to be much simpler than using NetMon or Achilles, and includes a simple but powerful JScript.NET event-based scripting subsystem. Free, for Windows.

FREEping - Free ping software utility from Tools4ever which will ping all your Windows-based servers (or any other IP address) in freely-definable intervals. Will send a popup when one of the servers stops responding.

IP Traffic Test and Measure - Network traffic simulation and test tool from Omnicor Corp. can generate TCP/UDP connections using different IP addresses; data creation or capture and replay; manage and monitor throughput, loss, and delay.

VisitorVille - Site traffic monitoring tool from World Market Watch Inc. that depicts website visitors as animated characters in a virtual village; users can watch their web traffic as if they’re watching a movie.

Sandra - ‘System ANalyser, Diagnostic and Reporting Assistant’ utility from SiSoftware. Provides large variety of information about a Windows system’s hardware and software. Includes CPU, mainboard, drives, ports, processes, modules, services, device drivers, ODBC sources, memory details, environment settings, system file listings, and much more. Provides performance enhancing tips, tune-up wizard, file system and memory bandwidth benchmarking, more. Reporting via save/print/fax/email in text, html, XML, etc. Free, Professional, and other versions available in multiple languages.

Deque - Deque Ramp is a cross-platform solution for testing and remediating websites and Web-based applications for integrated accessibility and Section 508 compliance. Audits and corrects accessibility violations and helps organizations develop long-term practices to enhance accessibility for users with disabilities. Available versions include Ramp Personal Edition, Ramp Grade, and Ramp Ascend. Ramp PE version is free for some user categories such as non-profit organizations. Other products include Worldspace Online, an online accessibility test and repair tool.

Browser Cam - Service from Gomez Inc./Compuware for web developers and testers; it creates screen captures of web pages loaded in any browser, any version, any operating system. Check javascripts, DHTML, forms and other dynamic functionality on any platform. Allows viewing of web page appearance on Windows, Linux, Macintosh, in most versions of every browser ever released.

Dummynet - Flexible tool developed by Luigi Rizzo, originally designed for testing networking protocols, can be used in testing to simulate queue and bandwidth limitations, delays, packet losses, and multipath effects. Can be used on user’s workstations, or on FreeBSD machines acting as routers or bridges.

HTTP Interceptor - A real-time HTTP protocol analysis and troubleshooting tool from AllHTTP.com. View all headers and data that travel between your browser and the server. Split-screen display and dual logs for request and response data. Interceptor also allows changing of select request headers on-the-fly, such as “Referrer” and “User Agent”.

SpySmith - Simple but powerful diagnostic tool from Quality Forge; especially useful when testing web sites and web-based applications. It allows the user to peek inside I.E. Browser-based Documents (including those without a ‘view source’ command) to extract precise information about the DOM elements in an HTML source. SpySmith can also spy on Windows objects. For Windows. Free 90-day trial.

Co-Advisor - Tool from The Measurement Factory for testing quality of protocol implementations. Co-Advisor can test for protocol compatibility, compliance, robustness, security, and other quality factors. Has modules for HTTP (RFC 2616) and ICAP (RFC 3507) protocols . Other info: runs on FreeBSD packages, Linux RPMs, Windows (on-demand); available as on-line service, binaries, or source code.

PocketSOAP - Packet-capture tool by Simon Fell, with GUI; captures and displays packet data between local client and specified web server. Can log captures to disk. For Windows; binaries and source available; freeware. Also available is PocketXML-RPC and PocketHTTP.

TcpTrace - Tool by Simon Fell acts as a relay between client and server for monitoring packet data. Works with all text-based IP protocols. For windows; freeware

ProxyTrace - Tool by Simon Fell acts as a proxy server to allow tracing of HTTP data; can be used by setting browser to use it as a proxy server and then can monitor all traffic to and from browser. Freeware.

tcptrace - Tool written by Shawn Ostermann for analysis of TCP dumpfiles, such as those produced by tcpdump, snoop, etherpeek, HP Net Metrix, or WinDump. Can produce various types of output with info on each connection seen such as elapsed time, bytes, and segments sent and received, retransmissions, round trip times, window advertisements, throughput, and various graphs. Available for various UNIX flavors, for Windows, and as source code; freeware.

MITS.Comm - Tool from Omsphere LLC for simulating virtually any software interface (internal or external). Allows testing without pitfalls associated with live connections to other systems (TCP/IP, Ethernet, FTP, etc). Allows developers to test down to the unit level by simulating the internal software interfaces (message queues, mailboxes, etc.) Tool can learn what request/response scenarios are being tested for future tests and can work with any protocol, any message definitions, and any network. Also available: MITS.GUI

XML Conformance Test Suite - XML conformance test suites from W3C and NIST; contains over 2000 test files and an associated test report (also in XML). The test report contains background information on conformance testing for XML as well as test descriptions for each of the test files. This is a set of metrics for determining conformance to the listed W3C XML Recommendation.

Certify - Test automation management tool from WorkSoft, Inc. For managing and developing test cases and scripts, and generating test scripts. For automated testing of Web, client/server, and mainframe applications. Runs on Windows platforms.

HiSoftware AccVerify - Tool for testing site accessibility, usability, searchability, privacy and Intellectual Property policy verification; from HiSoftware Inc. Also custom checks and test suites to meet organization’s standards. Can crawl a site and report errors; can also programmatically fix most common errors found. Runs on Windows.

HiSoftware Web Site Monitor - Tool allows user to monitor servers and send alerts, allows monitoring web sites for changes or misuse of intellectual property in metadata or in the presented document; link validation. From HiSoftware Inc.

Web Optimizer - Web page optimizing tool from Visionary Technologies intelligently compresses web pages to accelerate web sites without changing site’s appearance. Removes unnecessary information in HTML, XML, XHTML, CSS, and Javascript and includes GIF and JPEG optimizer techniques.

HTML2TXT - Conversion utility that converts HTML as rendered in MS Internet Explorer into ASCII text while accurately preserving the layout of the text. Included with software are examples of using the control from within Visual Basic, Visual C++, and HTML.

Team Remote Debugger - Debugging tool from Spline Technologies allows tracing of any number of code units of any kind ( ASP, MTS, T-SQL, COM+, ActiveX Exe, DLL, COM, Thread, CFML ), written in any language ( ASP, VB, VC++, Delphi, T-SQL, VJ, CFML ) residing on multiple shared and dedicated servers at the same time, without ever attaching to process. Remote code can pass messages and dialogs directly to your local machine via Team Remote Debugger component, and developers can then debug their respective code independently of one another no matter if the code units reside on the same servers or on different servers or on any combination thereof.

Datatect - Test data generator from Banner Software generates data to a flat file or ODBC-compliant database; includes capabilities such as scripting support that allows user to write VBScripts that modify data to create XML output, data generation interface to Segue SilkTest, capability to read in existing database table structures to aid in data generation, wide variety of data types and capabilities for custom data types. For Windows.

Triometric Performance Analyzer Suite - Suite of software protocol analyzers from Triometric accurately calculates end-to-end download speeds for each transaction, not just samples; produces a range of configurable reports that breaks down info into network and server speeds, errors, comparison to SLA’s, performance for each server, client, URL, time period, etc.

WebBug - Debugging tool from Aman Software for monitoring HTTP protocol sends and receives; handles HTTP 0.9/1.0/1.1; allows for entry of custom headers. Freeware.

WebMetrics - Web usability testing and evaluation tool suite from U.S. Govt. NIST. Source code available. For UNIX, Windows.

MRTG - Multi Router Traffic Grapher – free tool by Tobi Oetiker utilizing SNMP to monitoring traffic loads on network links; generates reports as web pages with GIF graphics on inbound and outbound traffic. For UNIX, Windows.

source: http://qtpchallenge.wordpress.com/2012/04/

Methods of Reading Data from EXCEL Sheet -Using VBScript

Method #1
Datatable.Importsheet “path of the excel file.xls”, source sheet ID/Name, desination sheet ID/Name
Datatable.SetCurrentRow(1)  ‘Read Value from First Row
value = datatable.Value(parameterName,Sheet ID/Name)
‘To Read Value from All the rows
Datatable.Importsheet “path of the excel file.xls”, source sheet ID/Name, desination sheet ID/Name
For vRow = 1 To Datatable.GetRowCount
Datatable.SetCurrentRow(vRow)
value = datatable.Value(parameterName,Sheet ID/Name)
Next

Method #2
Dim objexcel, objWorkbook, objDriverSheet, columncount, rowcount
set objexcel = Createobject(“Excel.Application”)
Set objWorkbook = objExcel.WorkBooks.Open(“path of the file.xls”)
Set objDriverSheet = objWorkbook.Worksheets(“name of the sheet / Id of the sheet”)
columncount = objDriverSheet.usedrange.columns.count
rowcount = objDriverSheet.usedrange.rows.count
for i = 1 to colunmcount
columnname = objDriversheet.cells(i,1)
if columnname = knowncolumnname then
for j = 1 to rowcount
fieldvalue = objdriversheet.cells(j,i)
next
end if
next
Method #3
Function GetDataFromDB (strFileName, strSQLStatement)
Dim objAdCon, objAdRs
Set objAdCon = CreateObject(“ADODB.Connection”)
objAdCon.Open “DRIVER={Microsoft Excel Driver (*.xls)};DBQ=”&strFileName & “;Readonly=True”
If Err <> 0 Then
Reporter.ReportEvent micFail,”Create Connection”, “[Connection] Error has occured. Error : ” & Err
Set obj_UDF_getRecordset = Nothing
Exit Function
End If
Set objAdRs = CreateObject(“ADODB.Recordset”)
objAdRs.CursorLocation=3                        ‘ set the cursor to use adUseClient – disconnected recordset
objAdRs.Open strSQLStatement, objAdCon, 1, 3
MsgBox objAdRs.fields(4).name
While objAdRs.EOF=false
For i=0 to objAdRs.Fields.count
Msgbox objAdRs.fields(i)
Next
objAdRs.moveNext
Wend
If Err<>0 Then
Reporter.ReportEvent micFail,”Open Recordset”, “Error has occured.Error Code : ” & Err
Set obj_UDF_getRecordset = Nothing
Exit Function
End If
Set objAdRs.ActiveConnection = Nothing
objAdCon.Close
Set objAdCon = Nothing
End Function
Example
Set rsAddin = GetDatasFromDB(“C:Documents and SettingsgrameshDesktopLogin.xls”, “Select * from [Login$]“)

Excel Get Used Range Count and Insert Picture using VB Scripting

Set objXL = CreateObject(“Excel.Application”)
objXL.visible = True
objXL.DisplayAlerts = false
Set wkb = objXL.Workbooks.Open(ExcelFilePath)
Set ws = wkb.Sheets(“Sample”)
Used_RowCount =  ws.UsedRange.Rows.Count
Used_ColumnCount =  ws.UsedRange.Rows.Count
Next_Row_Range = Used_RowCount +3
Add_Column_Range = Used_ColumnCount + 10
Cell_Range = “A” & Next_Row_Range &”:G” & Add_Column_Range
Set objRng = ws.Range(Cell_Range)
‘Insert Picture..
objRng.Merge
Set Picture = ws.Pictures.Insert(ImageFilePath)
With Picture
.Top = objRng.Top
.Left = objRng.Left
.Width = objRng.Width
.Height = objRng.Height
End With
‘Insert text …
ws.Cells(Cell_Range).Value = “Test value”
wkb.SaveAs ExcelFilePath
wkb.Close
objXL.Quit
‘********************************************************
Function FindLastCell()
Dim lRow As Long, lCol As Integer, mRow As Long, mCol As Integer
lCol = ActiveSheet.UsedRange.Columns.Count
mRow = 0
For i = 1 To lCol
lRow = Range(Cells(rows.count, i), Cells(rows.count, i)).End(xlUp).Row
If lRow > mRow Then
mRow = lRow
mCol = i
Else
End If
Next i
FindLastCell = Range(Cells(mRow, mCol), Cells(mRow, mCol)).Address
End Function

VBScript Code Snippets for storing the QTP Test Results at our desired central location [FrmWrk-Folder Structure]

launch QTP in such way that it starts by saving results in the desired lcoation…here QTPResultspath is the location that has been created in QTPResults folder and then QTP is invoked and initiated to save results in the predetermined location….
qtResultsOpt.ResultsLocation = QTPResultspath
App.Test.Run qtResultsOpt
‘App.Test.Run
‘___________________CODE________________
MasterFolder = “C:TestAutomation”
Dim App, qtResultsOpt, fso, f
Set App = CreateObject(“QuickTest.Application”)
If App.Launched = False Then
App.Launch
End If
App.Visible = True
App.Options.Run.ImageCaptureForTestResults = “Always”
App.Options.Run.RunMode = “Fast”
App.Options.Run.ViewResults = True
App.Open MasterFolder&”TestsEFiles”,False,False
App.Test.Settings.Resources.Libraries.RemoveAll
App.Test.Settings.Resources.Libraries.Add MasterFolder&”Business FunctionsTestScripts.vbs”
‘__________________ START of creating a result folder _________________
Temp = Now
Temp1 = Replace (Temp, “/”,”-”)
Temp2 = Replace(Temp1,” AM”,”")
Temp3 = Replace(Temp2,” PM”,”")
Temp4 = Replace(Temp3,”:”,”")
FolderName = Replace(Temp4,” “,”_”)
‘QTPResultspath = “C:TestAutomationQTPResults”&FolderName
QTPResultspath = MasterFolder&”QTPResults”&FolderName
Set fso = CreateObject(“Scripting.FileSystemObject”)
If Not fso.FolderExists(QTPResultspath) Then
Set f = fso.CreateFolder(QTPResultspath)
End If
Set f = nothing
Set fso = nothing
‘__________________ END of creating a result folder _________________
Set qtResultsOpt = CreateObject(“QuickTest.RunResultsOptions”)
qtResultsOpt.ResultsLocation = QTPResultspath
App.Test.Run qtResultsOpt
‘App.Test.Run
Set App = nothing
Set qtResultsOpt = Nothing

Working with WMI (Windows Management Infrastructure)

Dim flag, AllProcess, AppToRun
AppToRun = “iexplore.exe”
Flag = Flase
Set AllProcess = GetObject(“winmgmts:”)
For Each Process In AllProcess.InstancesOf(“Win32_process”)
If (Instr ((Process.Name), AppToRun) = 1) Then
Print “Internet Explorer is running..”
Flag = Ture
Exit For
End If
Next
If Flag = Flase Then
Print “Internet Explorer  isnot running..”
SystemUtil.Run AppToRun
End If
You can do the same for any process/application. You just need to change the value of AppToRun variable. 

Working on Windows Shell, Registy keys and TextUtil using QTP

Change the Registry Key Values:
‘f_WriteRegEdit(“HKCUControl PanelInternationalsShortDate”,datatable(“DateFormat”),”REG_SZ”)
Function f_WriteRegEdit(strKeyPath,strKeyVal,strValType)
Set WshShell = CreateObject(“WScript.Shell”)
WshShell.RegWrite strKeyPath, strKeyVal, strValType
End Function
msgbox f_ReadRegEdit(“HKCUControl PanelInternationalsShortDate”)
Function f_ReadRegEdit(strKeyPath)
Set WshShell = CreateObject(“WScript.Shell”)
f_ReadRegEdit=WshShell.RegRead (strKeyPath)
End Function


How to make QC Status incomplete, during script execution:
Reporter.ReportEvent micPass,”test”,”test”
Set WshShell = CreateObject(“WScript.Shell”)
WshShell.SendKeys “{F4}”
Reporter.ReportEvent micPass,”test”,”test”
——————————————————————————————————————————————
Window or Page  is not recognizing ???? you may use shell scripting and textutil.GetText to avoid such situations…
Let me know if you have any issues using the code…
Set WshShell = CreateObject(“WScript.Shell”)
WshShell.SendKeys “{TAB 1}”
WshShell.SendKeys “some data”
msgbox textutil.GetText(“1704986″)

Release Locked QTP Tests from QC

Set QCConnection=QCUtil.QCConnection
Set con=QCConnection.command
con.CommandText=”DELETE FROM LOCKS WHERE LK_USER = ‘USERID’ “
Set recset=con.execute
*Mention your QC USER ID in above code
***********************************************************************************************
you can find this info. in QC Site Configuration TAB (Use QC Admin login) , Lock_TimeOut option

Script to upload attachment in QC test lab

Dim oCurrentTest,oAttachment
Set oCurrentTest = QCUtil.CurrentTest.Attachments
Set oAttachment = oCurrentTest.AddItem(Null)
oAttachment.FileName = “C:Results.xls”
oAttachment.Type = 1 oAttachment.Post
oAttachment.Refresh Set
oAttachment =Nothing
Set oCurrentTest =Nothing

4 Different Ways to Associate Function Libraries to your QTP Scripts

Most of the times, when you are creating test scripts or are designing a new QTP Framework, you would be trying to come up with reusable functions which you would have to store in the function library. Now, in order to use this function library with multiple test cases, you need to associate this function library with your scripts. This article explains the 4 methods that will help you in associating the function libraries in QTP Test Cases.
Based on the type of framework you are using, you can use any of the following methods to associate function libraries to your QTP Script -
  • 1) By using ‘File > Settings > Resources > Associate Function Library’ option in QTP.
  • 2) By using Automation Object Model (AOM).
  • 3) By using ExecuteFile method.
  • 4) using LoadFunctionLibrary method.
Let’s see in detail how each of these methods can be used to map function libraries to your test scripts.

1. Using ‘File > Settings > Resources > Associate Function Library’ option from the Menu bar

This is the most common method used to associate a function library to a test case. To use this method, select File > Settings option from the Menu bar. This will display the ‘Test Settings’ window. Click on Resources from the left hand side pane. From the right hand side pane, click on the ‘+’ button and select the function library that needs to be associated with the test case.
Associate function Library to QTPAssociate function Library to QTP

2. Using AOM (Automation Object Model)

QTP AOM is a mechanism using which you can control various QTP operations from outside QTP. Using QTP Automation Object Model, you can write a code which would open a QTP test and associate a function library to that test.
Example: Using the below code, you can open QTP, then open any test case and associate a required function library to that test case. To do so, copy paste the below code in a notepad and save it with a .vbs extension.
1
2
3
4
5
6
7
8
9
10
11
12
13
'Open QTP
Set objQTP = CreateObject("QuickTest.Application")
objQTP.Launch
objQTP.Visible = True
'Open a test and associate a function library to the test
objQTP.Open "C:AutomationSampleTest", False, False
Set objLib = objQTP.Test.Settings.Resources.Libraries
'If the library is not already associated with the test case, associate it..
If objLib.Find("C:SampleFunctionLibrary.vbs") = -1 Then ' If library is not already added
  objLib.Add "C:SampleFunctionLibrary.vbs", 1 ' Associate the library to the test case
End

3. Using ExecuteFile Method

ExecuteFile statement executes all the VBScript statements in a specified file. After the file has been executed, all the functions, subroutines and other elements from the file (function library) are available to the action as global entities. Simply put, once the file is executed, its functions can be used by the action. You can use the below mentioned logic to use ExecuteFile method to associate function libraries to your script.
1
2
3
4
5
'Action begins
ExecuteFile "C:YourFunctionLibrary.vbs"
'Other logic for your action would come here
'.....

4. Using LoadFunctionLibrary Method

LoadFunctionLibrary, a new method introduced in QTP 11 allows you to load a function library when a step runs. You can load multiple function libraries from a single line by using a comma delimiter.
1
2
3
4
5
6
7
8
'Some code from the action
'.....
LoadFunctionLibrary "C:YourFunctionLibrary_1.vbs" 'Associate a single function library
LoadFunctionLibrary "C:FuncLib_1.vbs", "C:FuncLib_2.vbs" 'Associate more than 1 function libraries
'Other logic for your action would come here
'.....
This was all about the different ways using which you can associate function libraries to QTP Scripts. What are your views on this article? Can you think of any other points which I have missed and can be added here? Please let us know your views using the comments section. Happy Reading.. :–)
Reference: http://www.automationrepository.com/2011/09/associate-function-library-to-qtp-script/

ALM/QC – How to Update a Test Plan Field using OTA

 Is it possible to use OTA to update a Test Plan Field in ALM/QC?
Since writing my posts “How to Update a Defect using OTA” and “How to Update a Test Set Field Using OTA” I’ve received a few emails inquiring if it’s possible to also update information for an ALM Test Plan using HP’s Open Test Architecture (OTA).

The quick answer is “Yes” but rather than answer each one individual, I thought it would be better to frame my replay in the form of a quick post.
How to get the QC/ALM field name
In order to update a field in ALM using OTA you will need to know the backend name that ALM assigns to the field. This name is normally different than the label name that you might see in the ALM Test Lab section.
If you don’t know what the actual field names are, you can easily find them by going into QC’s Tools>Customize.
In the Project Customization section and go into the “Project Entities” section.


Under the Project Entities Tree view click expand Defect and click on your System Folder or User Fields. Clicking on a field will reveal the field name that you will need to use.
For this example I want to find the System Field > Status and get the name value for it (TS_STATUS)


QTP OTA Code to Update a Test Plan Field in an ALM/QC Test Lab
 
The following example updates the ‘Test Plan’ that has the ‘Test Set ID’ of 6 and changes the ‘Status’ field to Ready.

The code is pretty straight forward and uses the OTA’s TestFactory object to accomplish our goal.
  • Creating an instance of the TestFactory object allows us to access all the services needed to manage tests.
  • Next you set the Filter property to set the ID for the test set that you want to update.
  • Finally use the TestFactory’s NewList method to create a list of object that matches your specified filter.
  • Make sure to use the Post method to actually write the changed values to your ALM database
'=========================================
set tdc = createobject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "http://yourURL/qcbin"
tdc.Login "yourName","yourPassword"
tdc.Connect "yourDomain","yourProject"
'=========================================
testPlanID = 6
Set TestList = tdc.TestFactory
Set TestPlanFilter = TestList.Filter
TestPlanFilter.Filter("TS_STATUS") = testPlanID

Set TestPlanList = TestList.NewList("")
Set myTestPlan = TestPlanList.Item(testPlanID)
myTestPlan.Field("TS_STATUS") = "Ready"
myTestPlan.Post

Set TestPlanFilter = Nothing
Set myTestPlan = Nothing
Set TestList = Nothing
Set TestPlanFilter = Nothing

How Update All Tests
There might be times when you need to update the same field for all the tests in your test plan. To update the same field for all your tests you could create code that loops thru all the tests:
'=========================================
set tdc = createobject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "http://yourURL/qcbin"
tdc.Login "yourName","yourPassword"
tdc.Connect "yourDomain","yourProject"
'=========================================
Set TestList = tdc.TestFactory
Set TestPlanFilter = TestList.Filter
Set TestPlanList = TestList.NewList("")
For each tpTest in TestPlanList
 Set myTestPlan = TestPlanList.Item(tpTest.ID)
 myTestPlan.Field("TS_STATUS") = "Ready"
 myTestPlan.Post
Next 
Set TestPlanFilter = Nothing
Set myTestPlan = Nothing
Set TestList = Nothing
Set TestPlanFilter = Nothing


How to run the code



To run the defect code you can either place it in QTP and run as a script or place the code in a text file and save as a .VBS vbscript file.


Automatic TestSet Execution via Script

 
User's Requirement
 
Need to execute a QTP TestSet without using Quality Center GUI
 
 
Proposal Solution
 
The solution is to have a script that accepts 2 input parameters that are:
  • Path TestLab
  • TestSet Name
 
Once the connection to QC has been done, through interaction with the user, selection of Domain and Project from combo, etc, it will be launch the execution of the TestSet on a Remote Machine.

 
 
_________________________________________________________________________
 
Script Implementation
 
Considerations:
this would be only an example, a case study, on how to work and manage with the TSScheduler OTA Object.
I think this type of implementation could have sense only in particular context, those whom who execs the testset doesn't know anything about Quality Center, how to move inside it and doesn't have any permission to access it (user and password could be retrieve from somewhere else instead of how has been developed here).
 
 
How this script works.
The script has been written starting from the example found in the OTA help for the TSScheduler object description and remanaged.
 
This script must be launched from DOS Command Prompt passing 2 parameters that rappresents the Path and the TestSet Name.
In the case the 2 parameters have some spaces those strings must be written between the char " .
For example: myScript.vbs "Root\Fld1\Sub Folder1_1\Other Folder" "My TestSet"
 
This is the code:
 
'This version consists on call the script passing 2 parameters that are:
'
' - Path TestLab (where the TestSet is located)
' - TestSet Name


'*******************************************************
'Constants to set where to run the entire TestSet or the single TSTest
'*******************************************************
Const RUN_LOCAL  = 0
Const RUN_REMOTE = 2
Const RUN_PLANNED_HOST = 8
Const REMOTE_MACHINE = "REMOTE.MACHINE.ON.SOME.DOMAIN"

'Constants for log file.
'*******************************************************
Const PathLogFile = "d:\LogSched\"   'The location of the file is out of scope
Const LogFile = "logSched.txt"          'for this task.
Const FOR_WRITING = 2
'*******************************************************
'Variables
'*******************************************************
Dim tdc, fso, fOut
Dim QC_ADDRESS
Dim DOMAIN
Dim PROJECT
Dim USER
Dim PASSWORD
Dim PathTestLab
Dim TestSetName
'*******************************************************
 
'*******************************************************
'*******************************************************
'            M  A  I  N
'*******************************************************
'*******************************************************
'Check the Arguments passed to the script
if wscript.arguments.count <> 2 then
 Msgbox "Arguments Number Error! I need 2 informations: " & vbNewLine & _
     "- TestSet Folder" & vbNewLine & _
     "- TestSet Name" & vbNewLine & vbNewLine & _
     "Thank you. End of Program", vbCritical + vbSystemModal, "Arguments Error!!!"
 wscript.quit  
end if
PathTestLab = wscript.Arguments(0)
TestSetName = wscript.Arguments(1)
 
'Log File
set fso = CreateObject("Scripting.FileSystemObject")
if Not(fso.FolderExists(PathLogFile)) then
 msgbox "Log Path " & PathLogFile & " Not Found! End of Program!!", vbSystemModal + vbCritical, "Log Path Error!"
 set fso = nothing
 wscript.quit
end if
set fOut = fso.OpenTextFile(PathLogFile & LogFile, FOR_WRITING, True)
fOut.WriteLine "Date/Hour: " & Now & " - Start TestSet Execution Procedure"  & vbNewLine & vbNewLine
 
'Create the TDConnection Object
set tdc = CreateObject("tdapiole80.tdconnection.1")

'    Ask user for QC Coordinates
QC_ADDRESS = ""
USER = ""
PASSWORD = ""
QC_ADDRESS = InputBox("Insert the QC Site in th form http://qcaddress/qcbin", "QC Address", "http://10.10.10.10/qcbin")
if QC_ADDRESS = "" then
 set tdc = Nothing
 fOut.Close
 set fOut = Nothing
 set fso = Nothing
 wscript.quit
end if
'   Retrieve User Credential
Dim strUC
strUC = getUserInfo     
'getUserInfo returns a string
'if it contains the sequence of chars "@||@" it means that user infos have been correctly retrieved.
if instr(strUC,"@||@") = 0 then
 set tdc = Nothing
 fOut.Close
 set fOut = Nothing
 set fso = Nothing
 wscript.quit
end if
USER = split(strUC,"@||@")(0)
'next if because many times no password is set.
if right(strUC,4) <> "@||@" then
 PASSWORD = split(strUC,"@||@")(1)
end if
'Try to estabilished the Connection to QC Project. If it's ok, do the RunTestSet!
if QCConnect(QC_ADDRESS, USER, PASSWORD) then
 'Call the Sub to Run the TestSet on Remote Machine
 RunTestSet PathTestLab, TestSetName, REMOTE_MACHINE, RUN_REMOTE

 else

    fOut.WriteLine "Date/Hour: " & Now & " - QC Connection Error"
  
end if
if tdc.Connected then
 tdc.Disconnect
end if

fOut.WriteLine "Date/Hour: " & Now & " - END of PROGRAM"
fOut.close
set tdc = nothing
set fOut = nothing
set fso = nothing
MSGBOX "END OF PROGRAM", vbSystemModal + vbInformation, "End Program"
wscript.quit
'*******************************************************
'*******************************************************
'       E  N  D     M  A  I  N
'*******************************************************
'*******************************************************
 
 
'*******************************************************  
'            F U N C T I O N S
'*******************************************************
'Function to Retrieve UserInfo
Public Function getUserInfo()
'   Creation of the form to insert user and password
' Create an IE object
Dim res
res = ""
Set objIE = CreateObject( "InternetExplorer.Application" )
' specify some of the IE window's settings
objIE.Navigate "about:blank"
objIE.Document.title = "User and Password" & String( 80, "=" )
objIE.ToolBar        = False
objIE.Resizable      = False
objIE.StatusBar      = False
objIE.Width          = 400
objIE.Height         = 240
' Center the dialog window on the screen
With objIE.Document.parentWindow.screen
     objIE.Left = (.availWidth  - objIE.Width ) \ 2
     objIE.Top  = (.availHeight - objIE.Height) \ 2
End With
' Wait till IE is ready
Do While objIE.Busy
    WScript.Sleep 200
Loop
' Insert the HTML code to prompt for user input
objIE.Document.body.innerHTML = "<div align=""center""><table cellspacing=""5"">" _
                                  & "<tr nowrap><th colspan=""2"">Insert User and Password " _
                                  & ":</th></tr><tr nowrap><td>User :" _
                                  & "</td><td><input type=""text"" size=""20"" id=" _
                                  & """User""></td></tr><tr nowrap><td>Password :" _
                                  & "</td><td><input type=""password"" size=""20"" id=" _
                                  & """Password""></td></tr></table>" _
                                  & "<p><input type=""hidden"" id=""OK"" name=""OK"" " _
                                  & "value=""0""><input type=""submit"" value="" OK "" " _
                                  & "onclick=""VBScript:OK.value=1""></p></div>"
' Hide the scrollbars
objIE.Document.body.style.overflow = "auto"
' Make the window visible
objIE.Visible = True
' Set focus on User input field
objIE.Document.all.User.focus

' Wait till the OK button has been clicked
On Error Resume Next
Do While objIE.Document.all.OK.value = 0
    WScript.Sleep 200

    If Err Then    'user clicked red X (or alt-F4) to close IE window    
    exit do
    End if

Loop

' Read the user input from the dialog window
if not(Err) then
 res = objIE.Document.all.User.value & "@||@" & objIE.Document.all.Password.value
end if

'Close and release the object
objIE.Quit
Set objIE = Nothing
 
getUserInfo = res
On Error Goto 0
End Function
 
'Boolean Function that Check the Connection to the Project.
Public Function QCConnect(addr, usr, pwd)
Dim Res, dom, prj
Res = True
On Error Resume Next
tdc.InitConnectionEx addr
if err.number <> 0 then
 Res = False
 msgbox "QC Error in method InitConnectionEx", vbSystemModal + vbCritical, "InitConnectionEx ERROR!!!!"
end if
if Res then
 err.clear
 tdc.login usr, pwd
 if err.number <> 0 then
  Res = False
  msgbox "QC Error in method Login", vbSystemModal + vbCritical, "Login ERROR!!!!"
 end if
end if
strDomAndPrj = getDomPrjInfo   'call the function to retrieve Domain and Project Selections
if instr(strDomAndPrj, "@||@") > 0 then
 dom = split(strDomAndPrj,"@||@")(0)
 prj = split(strDomAndPrj,"@||@")(1)

 if Res then
  err.clear
  tdc.Connect dom, prj
  if err.number <> 0 then
   Res = False
   msgbox "QC Error in method Connect, check the Domain, Project and if user " & usr & " is allowed to the Project", vbSystemModal + vbCritical, "Connect ERROR!!!!"
  end if
 end if
 else
    Res = False
end if
QCConnect = Res
On error Goto 0
End Function

'Function that retrieve the Domain and Project Selection
Public Function getDomPrjInfo
Dim Res
Res = ""
set DomLst = tdc.VisibleDomains
optDomStr = ""
if DomLst.Count > 0 then
  for each dm in DomLst
 optDomStr = optDomStr & " <option value=" & chr(34) & dm & chr(34) & ">" & dm & "</option> " & vbNewLine
  next
end if
set DomLst = Nothing
optPrjStr = ""
' Form to select Domain and Project
' Create an IE object
Set objIE = CreateObject( "InternetExplorer.Application" )
' specify some of the IE window's settings
objIE.Navigate "about:blank"
objIE.Document.title = "Domain and Project" & String( 80, "=" )
objIE.ToolBar        = False
objIE.Resizable      = False
objIE.StatusBar      = False
objIE.Width          = 400
objIE.Height         = 240
' Center the dialog window on the screen
With objIE.Document.parentWindow.screen
     objIE.Left = (.availWidth  - objIE.Width ) \ 2
     objIE.Top  = (.availHeight - objIE.Height) \ 2
End With
' Wait till IE is ready
Do While objIE.Busy
    WScript.Sleep 200
Loop
' Insert the HTML code to prompt for user input
objIE.Document.body.innerHTML = "<div align=""center""><table cellspacing=""5"">" _
                                  & "<tr nowrap><th colspan=""2"">Select Domain and Project " _
                                  & ":</th></tr>" _       
          & "<label>Domain:<br>" _
          & "<select name=""Domain""> " _
          & optDomStr _
          & "</select> " _        
          & "</label></br>" _                  
          & "</table>" _       
                                  & "<p><input type=""hidden"" id=""OK"" name=""OK"" " _
                                  & "value=""0""><input type=""submit"" value="" OK "" " _
                                  & "onclick=""VBScript:OK.value=1""></p></div>"
' Hide the scrollbars
objIE.Document.body.style.overflow = "auto"
' Make the window visible
objIE.Visible = True
' Set focus on Domain input field
objIE.Document.all.Domain.focus

' Wait till the OK button has been clicked
Do While objIE.Document.all.OK.value = 0
    WScript.Sleep 200
 If Err Then    'user clicked red X (or alt-F4) to close IE window    
    exit do
    End if
Loop

if Not(Err) then
 ' Read the user input from the dialog window
 Res = objIE.Document.all.Domain.Value
 set PrjLst = tdc.VisibleProjects(Res)
 optPrjStr = ""
 for each pj in PrjLst
  optPrjStr = optPrjStr & " <option value=" & chr(34) & pj & chr(34) & ">" & pj & "</option> " & vbNewLine
 next
 ' Insert the HTML code to prompt for user input
 objIE.Document.body.innerHTML = "<div align=""center""><table cellspacing=""5"">" _
           & "<tr nowrap><th colspan=""2"">Select Domain and Project " _
           & ":</th></tr>" _       
           & "<label>Domain: " & Res & " <br>" _             
           & "</label></br>" _                  
           & "<label>Project:<br>" _
           & "<select name=""Project"" > " _
           & optPrjStr _
           & "</select> " _        
           & "</label></br>" _
           & "</table>" _       
           & "<p><input type=""hidden"" id=""OK"" name=""OK"" " _
           & "value=""0""><input type=""submit"" value="" OK "" " _
           & "onclick=""VBScript:OK.value=1""></p></div>"

 ' Hide the scrollbars
 objIE.Document.body.style.overflow = "auto"
 ' Make the window visible
 objIE.Visible = True
 ' Set focus on Project input field
 objIE.Document.all.Project.focus
 ' Wait till the OK button has been clicked
 Do While objIE.Document.all.OK.value = 0
  WScript.Sleep 200
  If Err Then    'user clicked red X (or alt-F4) to close IE window    
   exit do
  End if
 Loop
 
 ' Read the user input from the dialog window
 if Not(Err) then
  Res = Res & "@||@" & objIE.Document.all.Project.Value
 end if
end if
'Close and release the object
objIE.Quit
Set objIE = Nothing
getDomPrjInfo = Res
End Function
 
'This Sub is take from the example on OTA API TSScheduler Object description
Public Sub RunTestSet(tsFolderName, tSetName, _
           HostName, runWhere)
' This example show how to run a test set in three different ways:
' * Run all tests on the local machine (where this code runs).
' * Run the tests on a specified remote machine.
' * Run the tests on the hosts as planned in the test set.
    Dim TSetFact 'As TestSetFactory
 Dim tsList 'As List
    Dim theTestSet 'As TestSet
    Dim tsTreeMgr 'As TestSetTreeManager
    Dim tsFolder 'As TestSetFolder
    Dim Scheduler 'As TSScheduler
    Dim execStatus 'As ExecutionStatus

 On Error Resume Next    'my code

    'On Error GoTo RunTestSetErr
    'errmsg = "RunTestSet"

 ' Get the test set tree manager from the test set factory.
    'tdc is the global TDConnection object.
    Set TSetFact = tdc.TestSetFactory
    Set tsTreeMgr = tdc.TestSetTreeManager

 ' Get the test set folder passed as an argument to the example code. 
 'Dim nPath$
    'nPath = "Root\" & Trim(tsFolderName)
 '===> In this script the path has been passed as the 1st argument so nPath will be set directly to tsFolderName
 Dim nPath
 nPath = tsFolderName

 
 err.clear   'my add
    Set tsFolder = tsTreeMgr.NodeByPath(nPath)

 'my code
 if err.number <> 0 then
  msgbox "Error during the creation of the SysTreeNode for the path " & nPath, vbSystemModal + vbCritical, "QC Critical Error - Cannot Continue!!!"
  exit sub
 end if
 
 'If tsFolder Is Nothing Then
    '    err.Raise vbObjectError + 1, "RunTestSet", "Could not find folder " & nPath
    '    GoTo RunTestSetErr
    'End If
    'On Error GoTo RunTestSetErr

 ' Search for the test set passed as second argument to the example code.
    Set tsList = tsFolder.FindTestSets(tSetName)

 'I prefer the "Select case" statement instead of innested if
 Select case tsList.Count
   case 0: fOut.WriteLine "Date/Hour: " & Now & " -  TestSet " & tSetName & " not found under " & nPath & " !!!"
     exit Sub
   case 1: set theTestSet = tsList.Item(1)
   case else: fOut.WriteLine "Date/Hour: " & Now & " - Found more than one TestSet with the name & " & tSetName & " under " & nPath & " !!!"
        exit Sub
 End Select
    'If tsList.Count > 1 Then
    '    MsgBox "FindTestSets found more than one test set: refine search"
    'ElseIf tsList.Count < 1 Then
    '    MsgBox "FindTestSets: test set not found"
    'End If
    'Set theTestSet = tsList.Item(1)
    'Debug.Print theTestSet.ID
 
  '*******************************************************
  '      Start the scheduler on the local machine.
  '*******************************************************
    Set Scheduler = theTestSet.StartExecution("")
 'Set up for the run depending on where the test instances
 'are to execute.
    Select Case runWhere
        Case RUN_LOCAL
   ' Run all tests on the local machine.
            Scheduler.RunAllLocally = True
        Case RUN_REMOTE
   ' Run tests on a specified remote machine.
   ' ===> This set the HostName for the Scheduler Object <===
            Scheduler.TdHostName = HostName
            ' RunAllLocally must not be set for
            ' remote invocation of tests.
            ' Do not do this:
            ' Scheduler.RunAllLocally = False
        Case RUN_PLANNED_HOST
   ' Run on the hosts as planned in the test set.
            Dim TSTestFact 'As TSTestFactory
   Dim testList 'As List
            Dim tsFilter 'As TDFilter
            Dim TSTst 'As TSTest
   ' Get the test instances from the test set.
            Set TSTestFact = theTestSet.TSTestFactory
            Set tsFilter = TSTestFact.Filter
            tsFilter.Filter("TC_CYCLE_ID") = theTestSet.ID
            Set testList = TSTestFact.NewList(tsFilter.Text)
            'Debug.Print "Test instances and planned hosts:"
   ' For each test instance, set the host to run depending
   ' on the planning in the test set.
   ' It retrieves the HostName indicating into the TestInstance
            For Each TSTst In testList
                'Debug.Print "Name: " & TSTst.Name & " ID: " & TSTst.ID & " Planned Host: " & TSTst.HostName
                Scheduler.RunOnHost(TSTst.ID) = TSTst.HostName
            Next
            Scheduler.RunAllLocally = False
 
    End Select
 ' Run the tests.
 ' This is the same as RunTestSet
    Scheduler.Run
  '*******************************************************
  '     Get the execution status object.
  '*******************************************************
     Set execStatus = Scheduler.ExecutionStatus

 ' Track the events and statuses.
    Dim RunFinished 'As Boolean,
 Dim iter 'As Integer,   'I think this is not necessary
 Dim i 'As Integer
    Dim ExecEventInfoObj 'As ExecEventInfo,
 Dim EventsList 'As List
    Dim TestExecStatusObj 'As TestExecStatus

    'While ((RunFinished = False) And (iter < 100))
 Do While Not(RunFinished) '===> Change in a Do While statement
        'iter = iter + 1
        execStatus.RefreshExecStatusInfo "all", True   '===> Force the Refresh of all the test status!
        RunFinished = execStatus.Finished      '===> Checks if execution is finished or still in progress
        Set EventsList = execStatus.EventsList     '===> Retrieve the List of Execution Events that are ExecEventInfo Objects
        For Each ExecEventInfoObj In EventsList
            fOut.WriteLine "Event: " & ExecEventInfoObj.EventDate & " " & ExecEventInfoObj.EventTime & " " & vbNewLine & _
                    "Event Type: " & ExecEventInfoObj.EventType & vbNewLine & _
     "[Event types: 1-fail, 2-finished, 3-env fail, 4-timeout, 5-manual]"
        Next
        'Debug.Print Tab; execStatus.Count & " exec status"
        For i = 1 To execStatus.Count
            Set TestExecStatusObj = execStatus.Item(i)
            fOut.WriteLine "Date/Hour: " & Now & " - Status: " & vbNewLine & _
                        "Test ID (the ID of the Test in TestPlan):   " & TestExecStatusObj.TestID & vbNewLine & _
      "Test instance (the ID of the TestInstance): " & TestExecStatusObj.TSTestID & " " & vbNewLine & _
                        "Order:                                      " & TestExecStatusObj.TestInstance & vbNewLine & _                     
                        "Message:                                    " & TestExecStatusObj.Message & vbNewLine & _
      "Status:                                     " & TestExecStatusObj.Status & vbNewLine & _
      "=====================================================" & vbNewLine
        Next 'i

  'This part is for visualbasic code
        'Sleep() has to be declared before it can be used.
        'This is the module level declaration of Sleep():
        'Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
        'Sleep (5000)

  Wscript.Sleep (60000)  'wait 1 minute before next iteration.
  
 Loop
 'Wend 'Loop While execStatus.Finished = False
    'Debug.Print "Scheduler finished around " & CStr(Now)
    'Debug.Print
 On error Goto 0

'RunTestSetErr:
'    ErrHandler err, err.Description, errmsg, NON_FATAL_ERROR
End Sub
'*******************************************************