This document contains functions for common automation tasks like closing browsers, launching browsers, clicking links, finding objects, and reporting results. It defines functions for initializing and terminating a test, including loading variables, closing browsers, and generating an HTML report. It also includes functions for locking/unlocking the workstation and creating folder structures.
Using Cerberus and PySpark to validate semi-structured datasetsBartosz Konieczny
This short presentation shows one of ways to to integrate Cerberus and PySpark. It was initially given at Paris.py meetup (https://www.meetup.com/Paris-py-Python-Django-friends/events/264404036/)
Abstract:
This talk will introduce you to the concept of Kubernetes Volume plugins. We will not only help you understand the basic concepts, but more importantly, using practical examples, we will show how you can develop your own volume plugins and contribute them back to the community of the OSS project as large as Kubernetes.
We will conclude the talk by discussing various challenges one can come across when contributing to a high velocity OSS project of Kubernetes' size which can help you avoid the pain and enjoy the path.
Sched Link: http://sched.co/6BYB
Conférence données à l'Open World Forum, 05 octobre 2013.
Comment créer une base de données noSQL par paires clés-valeurs en moins d'une heure, en se basant sur le bibliothèques Nanomsg et LightningDB.
Using Cerberus and PySpark to validate semi-structured datasetsBartosz Konieczny
This short presentation shows one of ways to to integrate Cerberus and PySpark. It was initially given at Paris.py meetup (https://www.meetup.com/Paris-py-Python-Django-friends/events/264404036/)
Abstract:
This talk will introduce you to the concept of Kubernetes Volume plugins. We will not only help you understand the basic concepts, but more importantly, using practical examples, we will show how you can develop your own volume plugins and contribute them back to the community of the OSS project as large as Kubernetes.
We will conclude the talk by discussing various challenges one can come across when contributing to a high velocity OSS project of Kubernetes' size which can help you avoid the pain and enjoy the path.
Sched Link: http://sched.co/6BYB
Conférence données à l'Open World Forum, 05 octobre 2013.
Comment créer une base de données noSQL par paires clés-valeurs en moins d'une heure, en se basant sur le bibliothèques Nanomsg et LightningDB.
Reactive Web - Servlet & Async, Non-blocking I/OArawn Park
자바 서블릿(Java Servlet) 기술을 기반으로
리액티브 웹(REACTIVE WEB) 구현 과정을 공유!
1부, Servlet & Async, Non-blocking I/O
2부, Reactive Programing (작성 중)
3부, Spring Reactive Web (작성 중)
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...dantleech
Did you know that Generators and Pipelines can be combined in order to
solve software engineering problems?
Generators have been available to us in PHP for about 5 years, they are a very
powerful tool in a developers toolbox, they can be used to make your life
easier (e.g. as data providers in PHPUnit), to help process large amounts of
data, and even to enable co-operative multi-tasking.
Pipelines provide a way to compose complex tasks from stages.
In this talk we will briefly discuss a specific problem in PHPBench (a
benchmarking tool for PHP) which can be solved through the use of Generators
(and pipelines!). We will then explore both topics generally, before combining
them into an Incredible Machine in a live coding session.
Data File Handiling File POINTERS IN C++subham sahu
Understanding of file pointers ,seekg() , tellg(), seekp() and tellp().How to place a pointer to a right place in file.File operation with File pointer.File pointer examples,programs.
Starting with the system calll "getrusage", this returns synchronous, process-level information, mainly max RSS used. This talk describes the output from getrusage, the rusage formatting utility in ProcStats, and several examples of using it to examine time and memory use.
Optional first & final outputs to give baseline and total status, differencing avoids extraneous output, and user messages allow arbitrary stat's and tracking content.
The combination makes this nice for tracking both long-lived and shorter, more intensive processing.
Using Mikko Koppanen's PHP ZMQ extension we will look at how you can easily distribute work to background processes, provide flexible service brokering for your next service oriented architecture, and manage caches efficiently and easily with just PHP and the ZeroMQ libraries. Whether the problem is asynchronous communication, message distribution, process management or just about anything, ZeroMQ can help you build an architecture that is more resilient, more scalable and more flexible, without introducing unnecessary overhead or requiring a heavyweight queue manager node.
Everybody knows : Web is the platform of the future. Developing for the browser unfortunately requires us to learn and write JavaScript. Not only that but we also have to integrate the JavaScript client code with the server side, which often runs on the JVM (i.e. is written in Java). So we have to work in two different languages with completely different tools and APIs, and cannot share code between the client and the server.
The Google Web Toolkit (GWT) provides a way to write your client side web application entirely in Java and have it automatically translated to fast and compact JavaScript. It allows you to access all the browser functionality through a statically typed API. You only have to learn and use one language and you can use your code on the client as well as on the server.
The downside : Java is a bad match for the asynchronous programming model required on the browser and generally forces us to write and read a lot of boilerplate code.
In this session you'll see how programming GWT applications with Eclipse Xtend provides the best of both worlds:
Static typing with advanced IDE support meets a powerful and expressive language - right at your finger tips.
Auto-GWT : Better GWT Programming with XtendSven Efftinge
Presentation from GWT.create 2015 EU
Auto-GWT (auto-gwt.org) is a library for the Google Web Toolkit, that frees your code from unneccessary and complicated boilerplate and at the same time pushes the IDE capabilities to a new level. Auto-GWT is based on Xtend (xtendlang.org).
Xtend is a modern programming language that is 100% compatibly with existing Java libraries and even translates to readable Java source code. With it's slick syntax and powerful features such as lambdas, operator overloading and compile-time macros you can turn any verbose piece of Java code into a small and elegant piece of expressive Xtend code.
In this session we will show how Xtend can be used to program GWT applications and how well the typical GWT idioms are supported by the language.
In this talk I presented three important topics in Kotlin Standard Library: Scope Functions (let, apply, also, run and with); Annotations (Deprecated, Experimental, Jvm*, DslMarker); and Delegates (lazy, vetoable, observable)
Deconstructing the Functional Web with ClojureNorman Richards
Programming for the web in Clojure isn't hard, but with layers of abstraction you can easily lose track of what is going on. In this talk, we'll dig deep into Ring, the request/response library that most Clojure web programming is based on. We'll see exactly what a Ring handler is and look at the middleware abstraction in depth. We'll then take this knowledge and deconstruct the Compojure routing framework to understand precisely how your web application responds to request. At the end of the talk you should thoroughly understand everything that happens in the request/response stack and be able to customize your web application stack with confidence.
Updated for Houston Clojure Meetup 2/28/14
Psycopg2 - Connect to PostgreSQL using Python ScriptSurvey Department
It's the presentation slides I prepared for my college workshop. This demonstrates how you can talk with PostgreSql db using python scripting.For queries, mail at dipeshsuwal@gmail.com
Reactive Web - Servlet & Async, Non-blocking I/OArawn Park
자바 서블릿(Java Servlet) 기술을 기반으로
리액티브 웹(REACTIVE WEB) 구현 과정을 공유!
1부, Servlet & Async, Non-blocking I/O
2부, Reactive Programing (작성 중)
3부, Spring Reactive Web (작성 중)
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...dantleech
Did you know that Generators and Pipelines can be combined in order to
solve software engineering problems?
Generators have been available to us in PHP for about 5 years, they are a very
powerful tool in a developers toolbox, they can be used to make your life
easier (e.g. as data providers in PHPUnit), to help process large amounts of
data, and even to enable co-operative multi-tasking.
Pipelines provide a way to compose complex tasks from stages.
In this talk we will briefly discuss a specific problem in PHPBench (a
benchmarking tool for PHP) which can be solved through the use of Generators
(and pipelines!). We will then explore both topics generally, before combining
them into an Incredible Machine in a live coding session.
Data File Handiling File POINTERS IN C++subham sahu
Understanding of file pointers ,seekg() , tellg(), seekp() and tellp().How to place a pointer to a right place in file.File operation with File pointer.File pointer examples,programs.
Starting with the system calll "getrusage", this returns synchronous, process-level information, mainly max RSS used. This talk describes the output from getrusage, the rusage formatting utility in ProcStats, and several examples of using it to examine time and memory use.
Optional first & final outputs to give baseline and total status, differencing avoids extraneous output, and user messages allow arbitrary stat's and tracking content.
The combination makes this nice for tracking both long-lived and shorter, more intensive processing.
Using Mikko Koppanen's PHP ZMQ extension we will look at how you can easily distribute work to background processes, provide flexible service brokering for your next service oriented architecture, and manage caches efficiently and easily with just PHP and the ZeroMQ libraries. Whether the problem is asynchronous communication, message distribution, process management or just about anything, ZeroMQ can help you build an architecture that is more resilient, more scalable and more flexible, without introducing unnecessary overhead or requiring a heavyweight queue manager node.
Everybody knows : Web is the platform of the future. Developing for the browser unfortunately requires us to learn and write JavaScript. Not only that but we also have to integrate the JavaScript client code with the server side, which often runs on the JVM (i.e. is written in Java). So we have to work in two different languages with completely different tools and APIs, and cannot share code between the client and the server.
The Google Web Toolkit (GWT) provides a way to write your client side web application entirely in Java and have it automatically translated to fast and compact JavaScript. It allows you to access all the browser functionality through a statically typed API. You only have to learn and use one language and you can use your code on the client as well as on the server.
The downside : Java is a bad match for the asynchronous programming model required on the browser and generally forces us to write and read a lot of boilerplate code.
In this session you'll see how programming GWT applications with Eclipse Xtend provides the best of both worlds:
Static typing with advanced IDE support meets a powerful and expressive language - right at your finger tips.
Auto-GWT : Better GWT Programming with XtendSven Efftinge
Presentation from GWT.create 2015 EU
Auto-GWT (auto-gwt.org) is a library for the Google Web Toolkit, that frees your code from unneccessary and complicated boilerplate and at the same time pushes the IDE capabilities to a new level. Auto-GWT is based on Xtend (xtendlang.org).
Xtend is a modern programming language that is 100% compatibly with existing Java libraries and even translates to readable Java source code. With it's slick syntax and powerful features such as lambdas, operator overloading and compile-time macros you can turn any verbose piece of Java code into a small and elegant piece of expressive Xtend code.
In this session we will show how Xtend can be used to program GWT applications and how well the typical GWT idioms are supported by the language.
In this talk I presented three important topics in Kotlin Standard Library: Scope Functions (let, apply, also, run and with); Annotations (Deprecated, Experimental, Jvm*, DslMarker); and Delegates (lazy, vetoable, observable)
Deconstructing the Functional Web with ClojureNorman Richards
Programming for the web in Clojure isn't hard, but with layers of abstraction you can easily lose track of what is going on. In this talk, we'll dig deep into Ring, the request/response library that most Clojure web programming is based on. We'll see exactly what a Ring handler is and look at the middleware abstraction in depth. We'll then take this knowledge and deconstruct the Compojure routing framework to understand precisely how your web application responds to request. At the end of the talk you should thoroughly understand everything that happens in the request/response stack and be able to customize your web application stack with confidence.
Updated for Houston Clojure Meetup 2/28/14
Psycopg2 - Connect to PostgreSQL using Python ScriptSurvey Department
It's the presentation slides I prepared for my college workshop. This demonstrates how you can talk with PostgreSql db using python scripting.For queries, mail at dipeshsuwal@gmail.com
The fundamentals and advance application of Node will be covered. We will explore the design choices that make Node.js unique, how this changes the way applications are built and how systems of applications work most effectively in this model. You will learn how to create modular code that’s robust, expressive and clear. Understand when to use callbacks, event emitters and streams.
Deze presentatie is gegeven tijdens de KScope conferentie 2012
Spreker: Luc Bors
Titel: How to Bring Common UI Patterns to ADF
Onderwerp: Fusion Middleware - Subonderwerp: ADF
Eindgebruikers van bedrijfsapplicaties eisen dezelfde gebruikerservaring die ze kennen van bijvoorbeeld office applicaties en applicaties op het internet. Functies zoals bookmarking, favorieten en het werken met tabs wordt graag gezien in de dagelijkse werk. Het zoekmechanisme van Google, dat suggesties toont op basis van de ingevoerde tekst, is zo ´gewoon´ dat mensen dit in elke applicatie terug willen zien. Twitter en Facebook geven automatisch aan dat je nieuwe berichten hebt zonder dat je daar zelf eerst om moet vragen, dat gebruikers de normaalste zaak van de wereld vinden. Er zijn nog veel meer van deze UI patterns. In deze sessie leer je hoe een aantal van deze UI patterns in je ADF applicatie kunt inbouwen waardoor de eindgebruiker beschikking krijgt over bekende en vanzelfsprekende features. Dit zal leiden tot een snellere acceptatie van de applicatie en prettigere gebruikerservaring.
C Programming Projects -
1. Sort an array in ascending order.
2. Display sum of all odd values stored in an array.
3. Display number of even values stored in an array.
--
1. A file name is command line argument. Display the contents of the file where each word will be displayed on a new line. Display proper message if file does not exist.
2. Display no. of vowels stored in the file.
3. Display no. of “the” stored in the file.
4. Copy contents of the file to another file.
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018Codemotion
GraalVM challenges the status quo on the JVM. This newly-released JIT compiler brings substantial speed improvements and support for polyglot applications. It also allows us to translate our JVM bytecode into self-contained native binaries. In this session we’ll explore GraalVM’s potential. We’ll focus on Clojure, but our discussion will apply to many more programming languages. We’ll use GraalVM to build small native binaries. We’ll discuss the method’s limitations and their impact. Finally, we’ll build complete Clojure web apps weighing a fraction of their traditional JVM incarnations.
ASTs are an incredibly powerful tool for understanding and manipulating JavaScript. We'll explore this topic by looking at examples from ESLint, a pluggable static analysis tool, and Browserify, a client-side module bundler. Through these examples we'll see how ASTs can be great for analyzing and even for modifying your JavaScript. This talk should be interesting to anyone that regularly builds apps in JavaScript either on the client-side or on the server-side.
When working with enterprise applications, you want to have the same user experience that you know from for instance office applications and browsers. People know how to use the features that can be found in browsers such as bookmarking, favorites, and working with tabs. The search mechanism provided by Google, that uses suggestions based on the text typed by the user, is so common that people expect this in every application. And there are more of these UI patterns. In this session, you will learn how to implement some of the common UI patterns in your ADF application.
Twitter Author Prediction from Tweets using Bayesian NetworkHendy Irawan
Can We Predict the Author from a Tweet?
Most authors have a distinct writing style
... And unique topics to talk about
... And signature distribution of words used to tweet
Can we train Bayesian Network so that occurrence of words in a tweet can be used to infer the author of that tweet?
In summary: YES!
Disclaimer: Accuracy varies
In a test suite with @dakwatuna vs @farhatabbaslaw (very different tweet topics) – 100% prediction accuracy is achieved
Introduction to source{d} Engine and source{d} Lookout source{d}
Join us for a presentation and demo of source{d} Engine and source{d} Lookout. Combining code retrieval, language agnostic parsing, and git management tools with familiar APIs parsing, source{d} Engine simplifies code analysis. source{d} Lookout, a service for assisted code review that enables running custom code analyzers on GitHub pull requests.
TYPO3 Extension development using new Extbase frameworkChristian Trabold
My presentation for the TYPO3 community day in Tokyo, Japan.
The code is available at https://github.com/ctrabold/t3ski-workshop.
Due to copyright issues I had to remove all pictures of Miffy.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
top nidhi software solution freedownloadvrstrong314
This presentation emphasizes the importance of data security and legal compliance for Nidhi companies in India. It highlights how online Nidhi software solutions, like Vector Nidhi Software, offer advanced features tailored to these needs. Key aspects include encryption, access controls, and audit trails to ensure data security. The software complies with regulatory guidelines from the MCA and RBI and adheres to Nidhi Rules, 2014. With customizable, user-friendly interfaces and real-time features, these Nidhi software solutions enhance efficiency, support growth, and provide exceptional member services. The presentation concludes with contact information for further inquiries.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
Worried about document security while sharing them in Salesforce? Fret no more! Here are the top-notch security standards XfilesPro upholds to ensure strong security for your Salesforce documents while sharing with internal or external people.
To learn more, read the blog: https://www.xfilespro.com/how-does-xfilespro-make-document-sharing-secure-and-seamless-in-salesforce/
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Why React Native as a Strategic Advantage for Startup Innovation.pdfayushiqss
Do you know that React Native is being increasingly adopted by startups as well as big companies in the mobile app development industry? Big names like Facebook, Instagram, and Pinterest have already integrated this robust open-source framework.
In fact, according to a report by Statista, the number of React Native developers has been steadily increasing over the years, reaching an estimated 1.9 million by the end of 2024. This means that the demand for this framework in the job market has been growing making it a valuable skill.
But what makes React Native so popular for mobile application development? It offers excellent cross-platform capabilities among other benefits. This way, with React Native, developers can write code once and run it on both iOS and Android devices thus saving time and resources leading to shorter development cycles hence faster time-to-market for your app.
Let’s take the example of a startup, which wanted to release their app on both iOS and Android at once. Through the use of React Native they managed to create an app and bring it into the market within a very short period. This helped them gain an advantage over their competitors because they had access to a large user base who were able to generate revenue quickly for them.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
1. Private ObjFSO 'This is used to store FileSystemOb
ject Reference
Private strPvtTestCaseName 'This is used to srore T
estCaseName
Set ObjFSO = CreateObject("Scripting.FileSystemObje
ct") 'Create FileSystem Object
'#################################################
##################################################
#####################
' Library file name : fn_general.qfl
' Library file Description : Lists all the co
mmon functions that can be used across application
s :
' ################################################
##################################################
#####################
'*********FUNCTION: to close all open browsers
Function gen_closeAllBrowsers()
gen_closeAllBrowsers = False
While Browser("CreationTime:=0").Exist(0)
Browser("CreationTime:=0").Close
Wend
If NOT Browser("CreationTime:=0").Exist(2) Then
gen_closeAllBrowsers = True
End If
End Function
'*********FUNCTION: to launch a browser, returns br
owser object
Function gen_launchbrowser()
If gen_closeAllBrowsers Then
Set objIE = CreateObject("InternetExplorer.
Application")
Set gen_launchbrowser = objIE
End IF
End Function
'*********FUNCTION: to open application
Function gen_launchWebPortal(var_appUrl)
2. If gen_closeAllBrowsers Then
Set objBrowser = gen_launchbrowser()
objBrowser.visible=True
objBrowser.Navigate(var_appUrl)
End If
End Function
'*********FUNCTION: to open application
Function sap_launchWebPortal(var_appUrl)
If gen_closeAllBrowsers Then
SystemUtil.Run "iexplore",var_appUrl,,,3
End If
End Function
'*********FUNCTION: to click a link
Function gen_clickLink(obj_PageOrFrame, var_linkTex
t, var_class, var_htmlId)
Dim linkDesc,obj_linkToClick
Set linkDesc = Description.Create
linkDesc("html id").Value = var_htmlId
linkDesc("html tag").Value = "A"
linkDesc("class").Value = var_class
linkDesc("text").Value = var_linkText
Set obj_linkToClick = obj_PageOrFrame.ChildObje
cts(linkDesc)
If obj_linkToClick.Count = 1 Then
obj_linkToClick(0).click
Wait(3)
Else
Call gfReportExecutionStatus(micWarning, "
Link count mismatch", "Link is either missing or t
oo many links on page: " &var_linkText)
End If
End Function
'*****FUNCTION: to find child objects that match a
given description
Function gen_findObject(obj_pageOrFrame, arr_proper
ty, arr_value)
Set objPageOrFrame = obj_pageOrFrame
If UBound(arr_property) = UBound(arr_value) The
n
3. Set objDesc = Description.Create()
For ipropCnt = 0 to UBound(arr_property)
MsgBox arr_property(ipropCnt)&"::::"&ar
r_value(ipropCnt)
objDesc(arr_property(ipropCnt)).Value =
arr_value(ipropCnt)
Next
Set objFound = objPageOrFrame.ChildObjects(
objDesc)
MsgBox objFound.Count
For i = 0 to objFound.Count-1
MsgBox objFound(i).GetROProperty("titl
e")&":::::"&objFound(i).GetROProperty("html id")
Next
If objFound.Count=1 Then
gen_findObject = objFound(0)
Else
Call gen_printAndReport("Done", "Statu
s:Find Objects", "Too many objects or no object fo
und")
End If
End If
End Function
'*********FUNCTION: to print and report a step to t
he results
Public Function gen_printAndReport(var_eventStatus,
var_stepName, var_stepDetails)
print var_stepName&":::"&var_stepDetails
Select Case UCASE(var_eventStatus)
Case "DONE"
Reporter.ReportEvent micDone, var_stepN
ame, var_stepDetails
Case "WARN"
Reporter.ReportEvent micWarning, var_st
epName, var_stepDetails
Case "FAIL"
Reporter.ReportEvent micFail, var_stepN
ame, var_stepDetails
Case "PASS"
Reporter.ReportEvent micPass, var_stepN
ame, var_stepDetails
4. End Select
End Function
'*********FUNCTION: to create a Runtime data table,
returns the row count
Public Function gen_createRunTimeDataTable(var_SrcF
ile, var_srcSheet, var_destSheet)
DataTable.AddSheet var_destSheet
DataTable.ImportSheet var_SrcFile, var_srcS
heet, var_destSheet
gen_createRunTimeDataTable = DataTable.GetS
heet(var_destSheet).GetRowCount
End Function
'*********FUNCTION: to export the results file by a
ppending current date/time
Private Function gen_exportRunTimeDataTable(var_fil
eName)
var_fileNameWithoutExtn= Left(var_fileName,
instr(1,var_fileName,".xls")-1)
var_renameAs= val_dateForResultsFile&"_"&va
r_fileNameWithoutExtn&".xls"
DataTable.Export(val_outputData
FilePath&var_fileName)
Wait(5)
End Function
'*********FUNCTION: to import all the sheets to the
Data Table
Private Function gen_importAllSheetsFromFile(var_Sr
cFile,arr_srcSheets,arr_destSheets)
var_sheetCount = 0
For each srcSheet in arr_srcSheets
DataTable.AddSheet arr_destSheets(var_s
heetCount)
DataTable.ImportSheet var_SrcFile,srcSh
eet,arr_destSheets(var_sheetCount)
var_sheetCount = var_sheetCount+1
Next
End Function
'*********FUNCTION: to upload the image file to th
e attachments tab of a test or component in QC
Private Function gen_addAttachment(var_File)
If QCUtil.IsConnected = True Then
5. If NOT QCUtil.CurrentRun is Nothing Then
Set obj_attachPath = QCutil.CurrentRun.
Attachments
Set obj_attach = obj_attachPath.AddItem
(null)
obj_attach.FileName = var_File
Wait(2)
obj_attach.Type = 1
Wait(2)
obj_attach.Post
Wait(5)
obj_attach.Refresh
Call gen_printAndReport("Done", "Statu
s:File Upload", "Exported the runtime datatable to
QC Attachments folder in TestLab> CurrentRun")
End If
End If
Set obj_attachPath = Nothing
Set obj_attach = Nothing
End Function
'*********FUNCTION: to format the date, returns for
matted date
Private Function gen_formatDate(sFormat)
Set var_sysDate = DotNetFactory.CreateInsta
nce("System.DateTime")
Set oDate = var_sysDate.Parse(var_sysDate.N
ow.ToString)
gen_formatDate = oDate.ToString(sFormat)
Set var_sysDate = Nothing
End Function
'Environment File loading
'Call Environment.LoadFromFile("....EnvironmentE
nvironment.ini")
'#################################################
##################################################
################
'# Function: gfOnInitialize(ByVal strTestCaseName)
'# Function is used to initialize startup Resource
s like loading the Environment Repository and clos
ing all the
6. '# existing browsers except Quality center and Webe
x
'#
'# Parameters:
'# Input Parameters:
'# strTestCaseName - Name of the Test Case
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Use this procedure at the starting of the scrip
t to ensure all the browsers are closed and loadin
g the environment variables
'#
'# Usage:
'# The usage of this procedure is
'# > Call gfOnInitialize("BackOrder")
'#################################################
##################################################
################
Public Function gfOnInitialize(ByVal strTestCaseNam
e)
'UnLock WorkStation
'Call lpLockWorkStation("Disable")
'For HTML Reporting purpose Testcase name is s
tored in private variable so it will access in thi
s vbs only
strPvtTestCaseName = strTestCaseName
'Create AutomationReport Folder Structure
Call lpCreateFolderStructure(Environment("gval_
executionReportPath"))
'This will Enable all the reporting stuff
Reporter.Filter = rfEnableAll
'Reporting Test Case Name for providing more de
tails only in QTP Report
Reporter.ReportEvent micInfo, "TestCase: "&strT
estCaseName, "TestCase: "& strTestCaseName
'For InBuilt QTP Reporting Purpose
7. 'Call lpCustomReport(micInfo, strTestCaseName,
strTestCaseName)
'This will disable all the reporting stuff
' Reporter.Filter = rfDisableAll
'Close All Open Browsers
Call gfCloseAllBrowsers()
'Load Environment
Call lpLoadEnvironmentRepository()
End Function
'#################################################
##################################################
################
'# Function: gfOnTerminate()
'# Function is used to terminate the resources lik
e closing all the existing browsers and Generating
HTML Report
'#
'# Parameters:
'# Input Parameters:N/A
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Call this procedure at the end of the script to
Close the browser and generate the HTML report
'#
'# Usage:
'# The usage of this procedure is
'# > Call gfOnTerminate()
'#################################################
##################################################
################
Public Function gfOnTerminate()
'Cleaning up recordset memory
Set gLangObjIDRs = Nothing
8. 'Close all open browsers
Call gfCloseAllBrowsers()
'This is used to generate Html report
Call lpGenerateHtmlReport()
Call gflpGenerateHtmlReport()
Call lpDeleteFolders()
'Clean Up memory
strPvtTestCaseName = Empty
End Function
'#################################################
##################################################
################
'# Function: lpLockWorkStation(strEnableDisable)
'# This Function is used to Lock and UnLock the Sys
tem
'#
'# Parameters:
'# Input Parameters:strEnableDisable
'# If strEnableDisable=Disable Then UnLock The Syet
m
'# If strEnableDisable=Enable Then Lock The Syetm
'# OutPut Parameters: N/A
'#
'# Remarks:
'# This Function is used to Lock and UnLock the Sys
tem
'#
'# Usage:
'# The usage of this procedure is
'# > Call lpLockWorkStation("Disable") Or Call lpLo
ckWorkStation("Enable")
'#################################################
##################################################
################
Private Sub lpLockWorkStation(strEnableDisable)
Dim objShell 'ShellObject
'Create Shell Object
9. Set objShell = CreateObject("WScript.Shell")
If(UCase(strEnableDisable)="DISABLE") Then
'Lock WorkStation
objShell.RegWrite "HKCUSoftwareMicrosoft
WindowsCurrentVersionPoliciesSystemDisableLoc
kWorkstation", 00000001, "REG_DWORD"
ElseIf(Ucase(strEnableDisable)="ENABLE") Then
'UnLock WorkStation
objShell.RegWrite "HKCUSoftwareMicrosof
tWindowsCurrentVersionPoliciesSystemDisableLo
ckWorkstation", 00000000, "REG_DWORD"
End If
Set objShell = Nothing
End Sub
'#################################################
##################################################
################
'# Function: lpCreateFolderStructure(strStructurePa
th)
'# This Function is used to Create Folder Structure
'#
'# Parameters:
'# Input Parameters:strStructurePath - folder path
that needs to be created
'# OutPut Parameters: N/A
'#
'# Remarks:
'# This Function is used to Create Folder Structure
'#
'# Usage:
'# The usage of this procedure is
'# > Call lpCreateFolderStructure("C:AutomationRes
ultScreenShots")
'#################################################
##################################################
################
10. Private Sub lpCreateFolderStructure(gval_executionR
eportPath)
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemOb
ject")
If Not oFSO.FolderExists(gval_executionReportPa
th) Then
oFSO.CreateFolder gval_executionReportPath
End If
End Sub
'#################################################
##################################################
##################
'# Function: gfCloseAllBrowsers()
'# This Function is used to close all open browsers
except Quality center and WebEx.
'#
'# Parameters:
'# Input Parameters:N/A
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# This Function is used to close all open browsers
except Quality center and WebEx.
'#
'# Usage:
'# The usage of this Procedure is
'# blnStatus = gfCloseAllBrowsers()
'#################################################
##################################################
##################
Public Function gfCloseAllBrowsers()
Err.Clear
Dim objDesc,browserElements,numOfBrowsers,intCn
t
Dim strFuncName 'Procedure Name while displayin
g the Fail error message details
11. strFuncName = "Error in gfCloseAllBrowsers():"
'Close all the Dialogs and Windows that are ope
n
Call lpcloseAllDialogs()
'Retrive all Browsers from Desktop
Set objDesc = Description.Create()
objDesc("micClass").Value = "Browser"
' Set browserElements = Desktop.ChildObjects(objD
esc)
' numOfBrowsers = browserElements.Count
'Close all browsers except Quality Center
If Desktop.ChildObjects(objDesc).Count > 0 Then
For x = Desktop.ChildObjects(objDesc).Count - 1
To 0 Step -1
If InStr(1, Browser("creationtime:="&x).Get
ROProperty("title"), "Quality Center") = 0 And InS
tr(1, Browser("creationtime:="&x).GetROProperty("t
itle"), "WebEx Client Entry") = 0 And InStr(1, Br
owser("creationtime:="&x).GetROProperty("title"),
"Microsoft Office Live Meeting") = 0 Then
Browser( "creationtime:=" & x ).Close
End If
Next
End If
'Closes the Browser window (or tab) except Qual
ity Center and WebEX
' For intCnt = 0 To numOfBrowsers - 1
' If (InStr(browserElements(intCnt).GetROPro
perty("title"),"Quality Center") = 0 And InStr(bro
wserElements(intCnt).GetROProperty("title"),"WebEx
Client Entry") = 0 And InStr(browserElements(intC
nt).GetROProperty("title"),"Microsoft Office Live
Meeting") = 0 ) Then
' If (browserElements(intCnt).GetROProper
ty("disabled") = 0) Then
' browserElements(intCnt).Close
12. ' End If
' End If
' Next
'
' Set browserElements = Nothing
Wait(1)
' 'Check whether all open browsers are closed or
not except Quality Center and WebEX
' Desktop.ChildObjects(oDesc).Count = 0
' Set browserElements = Desktop.ChildObjects(objD
esc)
' numOfBrowsers = browserElements.Count
' If(numOfBrowsers > 0) Then
' For intCnt = 0 To numOfBrowsers - 1
' If (InStr(browserElements(intCnt).GetR
OProperty("title"),"Quality Center") = 0 And InStr
(browserElements(intCnt).GetROProperty("title"),"W
ebEx Client Entry") = 0 ) Then
' If(browserElements(intCnt).GetROPro
perty("disabled") = 0 ) Then
' Call gfReportExecutionStatus(m
icFail,strFuncName , "Unable to close the browser
" & browserElements(intCnt).GetROProperty("title"))
' End If
' End If
' Next
' End If
Set objDesc = Nothing
'Check and Report Runtime Errors If any
If (Err.Number<>0) Then
Call gfReportExecutionStatus(micFail,strFu
ncName,"Run Time Error Details : " & Chr(34) & str
FuncName & Err.Description & Chr(34))
Err.Clear
End If
End Function
'#################################################
##################################################
################
13. '# Function: lpLoadEnvironmentRepository()
'# Function is used to Load Environment Repository
'#
'# Parameters:
'# Input Parameters: N/A
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Loads the environment variables values present
in the environment repository to the global variab
les
'#
'# Usage:
'# The usage of this procedure is
'# > Call lpLoadEnvironmentRepository()
'#################################################
##################################################
################
Private Sub lpLoadEnvironmentRepository()
Dim strFuncName 'Procedure Name while displayin
g the Fail error message details
strFuncName = "Error in lpLoadEnvironmentReposi
tory():"
Err.Clear
'Read from Environment and Store in Global vari
ables
gstrBrowserType = Environment("browserType")
gSYNCWAIT = CInt(Environment("syncWait"))
gSHORTWAIT =CInt(Environment("shortWait"))
gMEDIUMWAIT = CInt(Environment("mediumWait"))
gLONGWAIT = CInt(Environment("longWait"))
gDELAYINTERVAL = CInt(Environment("delayInterva
l"))
gTIMEOUT = CInt(Environment("timeOut"))
' gLanguage = Environment("LanguageID")
' gLangExcelPathObjectID = Environment("LangExce
lPathObjectID") 'To retrieve the Object ID Excel
Path
' gLangObjIDSheetName = Environment("LangObjectI
DExcelSheetName") 'To retrieve the propert
14. ies data from the sheet
'Check and Report Runtime Errors If any
If (Err.Number<>0) Then
Call gfReportExecutionStatus(micFail,strFu
ncName,"Run Time Error Details : " & Chr(34) & str
FuncName & Err.Description & Chr(34))
Err.Clear
End If
End Sub
'#################################################
##################################################
################
'# Function: gfBrowserSync()
'# This Function is used to Wait Until BrowserPage
Loaded
'#
'# Parameters:
'# Input Parameters: N/A
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Procedure waits until the browser and page loads
completely
'#
'# Usage:
'# The usage of this procedure is
'# > Call gfBrowserSync()
'#################################################
##################################################
################
Public Function gfBrowserSync()
Err.Clear
Dim strFuncName 'Procedure Name while displayin
g the Fail error message details
Dim intCnt 'Counter for Browser Sync
strFuncName = "Error in gfBrowserSync():"
On Error Resume Next
15. Dim objBrowser,objPage,browserObjects,intBrows
ersCount,intBrowserIndex,pageObjects,intPagesCount
,intPageIndex
'Using DP Create Browser and page Objects
Set objBrowser = Description.Create()
objBrowser("micClass").Value = "Browser"
Set objPage = Description.Create()
objPage("micClass").Value = "Page"
'Retrive Browser Objects from DeskTop
Set browserObjects = Desktop.ChildObjects(objBr
owser)
intBrowsersCount = browserObjects.Count
'verifies for the Browser Count
If(intBrowsersCount > 0) Then
For intBrowserIndex = 0 To intBrowsersCount
- 1
If (InStr(browserObjects(intBrowserInd
ex).GetROProperty("title"),"Quality Center") = 0 A
nd InStr(browserObjects(intBrowserIndex).GetROProp
erty("title"),"WebEx Client Entry") = 0 ) Then
'Call Browser Sync For IE
If InStr(browserObjects(intBrowser
Index).GetROProperty("version"),"internet explorer
") > 0 Then
For intCnt = 0 To gSYNCWAIT
If browserObjects(intBrowse
rIndex).Object.ReadyState = 4 Then
Exit For
End If
Wait(1) 'Waiting for gSyncW
ait number of seconds
Next
Else
browserObjects(intBrowserIndex)
.Sync
End If
Set pageObjects = browserObjects(in
tBrowserIndex).ChildObjects(objPage)
intPagesCount = pageObjects.count
16. If (intPagesCount > 0) Then
For intPageIndex = 0 To intPage
sCount - 1
'Call Page Sync
pageObjects(intPageIndex).S
ync
Next
End If
End If
Next
End If
'Clean Up memory
Set objBrowser = Nothing
Set objPage = Nothing
Set browserObjects = Nothing
Set pageObjects = Nothing
Err.Clear
End Function
'#################################################
##################################################
################
'# Function: gfExitAction()
'# Function is used to Exit from Current Action
'#
'# Parameters:
'# Input Parameters:
'# strStepName - Step Name to report
'# strStepDetails - Step details to report
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Reports the fail message and terminates all the
existing applications and exiting from the curren
t action
'#
'# Usage:
'# The usage of this procedure is
17. '# > Call gfExitAction("Failed to find the object s
earchby")
'#################################################
##################################################
################
Public Function gfExitAction(ByVal strStepName, ByV
al strStepDetails)
'Call Report Event
Call gfReportExecutionStatus(micFail,strStepNam
e,strStepDetails)
'Before Exit from current Action call gfOnTermi
nate() procedure
'Call gfOnTerminate()
'Exit from Current Action
'On Error GoTo 0
'ExitAction((Environment("ActionName")))
End Function
'#################################################
##################################################
################
'# Function: gfReportExecutionStatus(ByVal intStatu
s,ByVal strStepDetails)
'# Function is used to report Pass/Fail/Done/Warnin
g messages in QTP inbuilt report
'#
'# Parameters:
'# Input Parameters:
'# intStatus - Pass/Fail/Info/Warned Status
'# strStepDetails - Step details to report
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# intStatus Parameter can be 0/1/2/3 or micPass,mi
cFail,micDone,micWarning
'#
'# Usage:
18. '# The usage of this procedure is
'# > Call gfReportExecutionStatus(micPass,"Expecte
d object displayed in Shopping cart page")
'#################################################
##################################################
################
Public Function gfReportExecutionStatus(ByVal intS
tatus,ByVal strStepName, ByVal strStepDetails)
Dim strImagePath 'Stores Image Path
Dim strStepNameNew
'This will enable all the reporting stuff For I
nBuilt QTP Reporting Purpose
Reporter.Filter = rfEnableAll
If Len(Trim(strStepName)) >0 Then
strStepNameNew=strStepName
If Len(Trim(gstrStepName)) >0 Then
strStepNameNew=gstrStepName & " " & str
StepName
End If
Else
strStepNameNew=gstrStepName
gstrStepName=""
End If
'This will report Pass/Fail/Done/Warning messa
ges in QTP inbuilt report and Text File
Select Case intStatus
Case 0,micPass:
'This will generate Cutom QTP inBuilt R
eport
Reporter.ReportEvent micPass,strStepNam
eNew,strStepDetails
'Call lpCustomReport(micPass,strStepNam
e,strStepDetails,"SUBROOT")
'This will generate Txt Trport
'Call lpGenerateTxtReport(0,Replace(st
rStepNameNew,vbCr,""),Replace(strStepDetails,vbCr,
""))
Case 1,micFail:
strImagePath = lfCaptureImage()
19. strStepDetails = strStepDetails & " -
- For More Details, Refer Screenshot at " & strIma
gePath
'This will generate Cutom QTP inBuilt R
eport
'Call lpCustomReport(micFail,gstrStepNa
me,strStepDetails,"SUBROOT")
Reporter.ReportEvent micFail,strStepNam
eNew,strStepDetails,strImagePath
'Call lpGenerateTxtReport(1,Replace(st
rStepNameNew,vbCr,""),Replace(strStepDetails,vbCr,
""))
Case 2,micDone:
' If(CBool (Environment("debugMode"))) Th
en
'This will generate Cutom QTP inBui
lt Report
'Call lpCustomReport(micDone,strSte
pDetails,"SUBROOT")
Reporter.ReportEvent micDone,gstrSt
epName,strStepDetails
'Call lpGenerateTxtReport(2,Replac
e(strStepNameNew,vbCr,""),Replace(strStepDetails,v
bCr,""))
' End If
Case 3,micWarning:
'This will generate Cutom QTP inBuilt R
eport
'Call lpCustomReport(micWarning,strStep
Name,strStepDetails,"SUBROOT")
Reporter.ReportEvent micWarning,gstrSte
pName,strStepDetails
'Call lpGenerateTxtReport(3,Replace(st
rStepNameNew,vbCr,""),Replace(strStepDetails,vbCr,
""))
End Select
'This will disable all the reporting stuff
' Reporter.Filter = rfDisableAll
End Function
'#################################################
20. ##################################################
##################
'# Function: gfClickObject(ByRef objControl)
'# This Function is used to click on the object fo
llowing controls like Link,Image,WebButton,WebElem
ent,WebRadioGroup
'# WinButton
'#
'# Parameters:
'# Input Parameters:
'# objControl - Object on which action to be perfor
med
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Clicks on the Object if Exist and Enabled else e
xits from the current action
'#
'# Usage:
'# The usage of this Procedure is
'# blnStatus = gfClickObject(Browser("brSOSDesignT
ools").Page("pgProductPage").Webbutton("btnSearch"
))
'#################################################
##################################################
##################
Public Function gfClickObject(ByRef objControl)
Err.Clear
Dim strTestObjectName
Dim strFuncName 'Procedure Name is stored for d
isplaying the Fail error message details
strFuncName = "Error in gfClickObject():"
strTestObjectName = lfToString(objControl)
'Re-identify the object in the application the
next time a step refers to this object
'objControl.RefreshObject
'check whether object objControl is exists or n
21. ot
If(gfObjectExists(objControl))Then
gfReportExecutionStatus micDone, strFuncNa
me ,"Object [" & strTestObjectName & "] Exist"
'check whether object objControl is enabled
or not
If (gfIsEnabled(objControl)) Then
gfReportExecutionStatus micDone, strFu
ncName , "Object [" & strTestObjectName & "]is in
Enabled State"
'Retrive objControl micClass
Select Case objControl.GetROProperty("m
icClass")
Case "WebButton","Link","Image","W
ebElement","WebRadioGroup","WinButton","WebCheckBo
x"
'objControl.Highlight
objControl.Click
gfReportExecutionStatus micD
one, strFuncName ,"Object [ " & strTestObjectName
& " ] is clicked!"
'Waits for the Browser/Page
to complete the current navigation.
End Select
Else
'If objControl is not exists then Exit
from current Action
On Error GoTo 0
Call gfExitAction(strFuncName ,"Object
[" & strTestObjectName & "[ is not in Enabled Sta
te")
End If
Else
'If objControl is not enabled then Exit fro
m current Action
On Error GoTo 0
Call gfExitAction(strFuncName , "Object ["
& strTestObjectName & "] dose not Exist")
End If
Call gfSyncApplication(objControl.GetROProperty
("micClass"))
22. 'Check and Report Runtime Errors If any
If (Err.Number<>0) Then
Call gfReportExecutionStatus(micFail,strFu
ncName,"Run Time Error Details : " & Chr(34) & str
FuncName & Err.Description & Chr(34))
Err.Clear
End If
End Function
'#################################################
##################################################
################
'# Function: gfOpenBrowser(ByVal strBrowserType, By
Val strURL)
'# Function is used to open the browser
'#
'# Parameters:
'# Input Parameters:
'# strBrowserType - Browser to be used to open the
url
'# strURL - Application URL to be opened
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Used to open the Browser
'#
'# Usage:
'# The usage of this Procedure is
'# > Call gfOpenBrowser("IE","http://google.com")
'#################################################
##################################################
##################
Public Function gfOpenBrowser(ByVal strBrowserType,
ByVal strURL)
Err.Clear
Dim strFuncName 'Procedure Name is stored for d
isplaying the Fail error message details
strFuncName = "Error in gfCloseAllBrowsers():"
23. Select Case UCase(strBrowserType)
Case gCnstIEBrowser
'SystemUtil.Run "iexplore.exe",strURL
SystemUtil.Run "iexplore.exe",strURL,
, ,3
Case gCnstFFBrowser
SystemUtil.Run "firefox.exe",strURL
End Select
'Waits for the Browser/Page to complete the cur
rent navigation.
Call gfBrowserSync()
'This is used to maximize Browser
'Call lpBrowserMaximize(Browser(Browser))
'Check and Report Runtime Errors If any
If (Err.Number<>0) Then
Call gfReportExecutionStatus(micFail,strFu
ncName,"Run Time Error Details : " & Chr(34) & str
FuncName & Err.Description & Chr(34))
Err.Clear
End If
End Function
'#################################################
##################################################
################
'# Function: gfDeleteResults(var_FolderPath)
'# Function is used to delete contents in folder
'#
'# Parameters:
'# Input Parameters:
'# var_FolderPath - Folder Path
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'#
'# Usage:
'# The usage of this Procedure is
24. '# > Call gfDeleteResults(var_FolderPath)
'#################################################
##################################################
##################
Public Function gfDeleteResults(var_FolderPath)
Dim Objfolder
Dim aFile
Set Objfolder = ObjFSOReport.GetFolder(var_FolderPa
th)
For Each aFile In Objfolder.Files
aFile.Delete
Next
End Function
'#################################################
##################################################
################
'# Function:gfUploadResults(var_FolderPath)
'# FUNCTION: to upload the Results HTML Report, Te
xt File, and screen shots to the attachments tab
of a test or component in QC
'#
'# Parameters:
'# Input Parameters:
'# var_FolderPath - Results path
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'#
'# Usage:
'# The usage of this Procedure is
'# > Call gfUploadResults(var_FolderPath)
'#################################################
##################################################
##################
Public Function gfUploadResults(var_FolderPath)
Err.Clear
Dim Objfolder
Dim aFile
Set Objfolder = ObjFSOReport.GetFolder(var_Fold
erPath)
25. For Each aFile In Objfolder.Files
Call gfaddAttachment(aFile)
Next
End Function
'*********FUNCTION: to upload the files to the atta
chments tab of a test or component in QC
Public Function gfaddAttachment(var_File)
Dim obj_attachPath,obj_attach
If QCUtil.IsConnected = True Then
If NOT QCUtil.CurrentRun is Nothing Then
Set obj_attachPath = QCutil.CurrentRun.
Attachments
Set obj_attach = obj_attachPath.AddItem
(null)
obj_attach.FileName = var_File
Wait(2)
obj_attach.Type = 1
Wait(2)
obj_attach.Post
Wait(5)
obj_attach.Refresh
End If
End If
Set obj_attachPath = Nothing
Set obj_attach = Nothing
End Function
'**************************************************
****************************************
'#################################################
##################################################
################
'#################################################
##################################################
################
'# Function is used to Maximize the Browser
'#
'# Parameters:
'# Input Parameters:
'# objBrowser - Browser to be maximized
26. '#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Remarks:
'# Usage:
'# The usage of this Procedure is
'# > Call gpBrowserMaximize(Browser("brSOSDesignToo
ls"))
'#################################################
##################################################
##################
Private Sub lpBrowserMaximize(ByRef objBrowser)
Err.Clear
Dim strFuncName 'Procedure Name is stored for d
isplaying the Fail error message details
strFuncName = "Error in lpBrowserMaximize():"
'On Error Resume Next
Dim hWnd
'Verify whether Browser type is firefox or Inte
rnet explorer
If(UCase(gstrBrowserType) = "FIREFOX") Then
Window("Mozilla Firefox").Maximize
ElseIf(UCase(gstrBrowserType) = "INTERNET EXPLO
RER") Then
hWnd = objBrowser.GetROProperty("hwnd")
Window("hwnd:=" & hWnd).Activate
If(Err.Number <> 0) Then
hWnd = Browser("hwnd:=" & hWnd).Object.
hWnd
Window("hwnd:=" & hWnd).Activate
Err.Clear
End If
Window("hwnd:=" & hWnd).Maximize
End If
'Check and Report Runtime Errors If any
27. If (Err.Number<>0) Then
Call gfReportExecutionStatus(micFail,strFu
ncName,"Run Time Error Details : " & Chr(34) & str
FuncName & Err.Description & Chr(34))
Err.Clear
End If
End Sub
'#################################################
##################################################
################
'# Function: lfCaptureImage()
'# Procedure used to save application failure image
when the script fails
'#
'# Parameters:
'# Input Parameters: N/A
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Captures the Image and Stores in the folder Capt
ureImages under executionReportPath
'#
'# Usage:
'# The usage of this Procedure is
'# > Call lfCaptureImage()
'#################################################
##################################################
##################
Private Function lfCaptureImage()
Err.Clear
Dim strImagesLoc,strImage,strImageSno,strReport
Path
Dim strFuncName 'Procedure Name is stored for d
isplaying the Fail error message details
strFuncName = "Error in lfCaptureImage()"
lfCaptureImage = ""
28. If(InStr(gval_executionReportPath,":")>0) Then
strImagesLoc = gval_executionReportPath
Else
strImagesLoc = Split(Environment("ProductD
ir"),":")(0) & ":" & gval_executionReportPath
End If
strImageSno = Environment("ActionName")
If InStr(Environment("ActionName"), " [") > 0 T
hen
strImageSno = Trim(Split(strImageSno, " [")
(0))
End If
strImageSno = strImageSno & "_" & Year(Now) &
gfNumberFormat(Month(Now),"00") & gfNumberFormat(D
ay(Now),"00") & "_" & gfNumberFormat(Hour(Now) ,"0
0") & gfNumberFormat(Minute(Now),"00") & gfNumberF
ormat(Second(Now),"00") & ".png"
'Saves a screen capture of the deskTop as a .pn
g Image
strImage = strImagesLoc & Chr(92) & strImageSno
Desktop.CaptureBitmap strImage,True
lfCaptureImage = strImage
'Check and Report Runtime Errors If any
If (Err.Number<>0) Then
' Call gfReportExecutionStatus(micFail,strFu
ncName,"Run Time Error Details : " & Chr(34) & str
FuncName & Err.Description & Chr(34))
Err.Clear
End If
End Function
'#################################################
##################################################
################
'# Function: lpGenerateTxtReport(ByVal intStatus,B
yVal strStepName,ByVal StrStepDescription)
29. '# Function is used to Generate Text Report
'#
'# Parameters:
'# Input Parameters:
'# intStatus - Pass/Fail status
'# strStepName-Step Name
'# StrStepDescription - Step description
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Generates text report
'#
'# Usage:
'# The usage of this Procedure is
'# > Call lpGenerateTxtReport("micPass","verify th
e mesage displayed in Shopping Cart page","Failed
to find the expected message")
'#################################################
##################################################
##################
Private Sub lpGenerateTxtReport(ByVal intStatus,ByV
al strStepName,ByVal StrStepDescription)
Err.Clear
'On Error Resume Next
Dim objTxtFile 'Objec
t to reference a file
Dim strStatus 'St
ring variable to hold the status of an action
Dim strOSInfo 'Stri
ng variable to hold the Operating system informati
on
Dim blnNewResult 'Boolean var
iable to hold the result
Dim strReportFileName 'String variable t
o hold the log file name
Dim strLogFileName 'String varia
ble to hold the log file name including path
Dim strReportPath 'String vari
30. able to hold the path of log file folder
Dim strMATCName 'String varia
ble to hold the Module,Action and TestCaseName
Dim objDateTime
Set objDateTime = DotNetFactory("System.DateTim
e")
'Initialize variables
'strMATCName = Split(Trim(Environment("TestNam
e")),"_")(1) & " $" & Trim(Environment("ActionNa
me") )& "$" & strPvtTestCaseName
strMATCName = gval_componentName
Environment("executionReportPath") = gval_execu
tionReportPath
If(Instr(Environment("executionReportPath"),":"
) > 0) Then
strReportPath = Split(Environment("executio
nReportPath"),"ScreenShots")(0)
Else
strReportPath = Split(Environment("Product
Dir"),":")(0) & Split(Environment("executionReport
Path"),"ScreenShots")(0)
End If
'strReportPath = Environment("executionReportPa
th")
'strReportFileName = Environment("reportTxtFile
Name")
strReportFileName = gval_reportTxtFileName
blnNewResult = False
strLogFileName = strReportPath & Chr(92) & strR
eportFileName & ".txt"
If (intStatus = 0) Then
strStatus = "Pass"
ElseIf (intStatus = 1) Then
strStatus = "Fail"
ElseIf (intStatus = 2) Then
strStatus = "Done"
31. ElseIf (intStatus = 3) Then
strStatus = "Warning"
End If
'Appending log to the report
strStepName = Chr(34) & strStepName & Chr(34)
StrStepDescription = Chr(34) & StrStepDescripti
on & Chr(34)
'Create Txt Log File if not exists
If (Not(ObjFSO.FileExists(strLogFileName))) The
n
Set objTxtFile = ObjFSO.OpenTextFile(strLog
FileName,8,True)
objTxtFile.WriteLine ""
objTxtFile.WriteLine vbTab & gval_htmlRepo
rtSuiteName & " Automation Test Suite Log"
objTxtFile.Close
Set objTxtFile = Nothing
blnNewResult = True
End If
'Opens the Text file
Set objTxtFile = ObjFSO.OpenTextFile(strLogFile
Name,8,True)
If(strMATCName <> gval_PrevTCName) Then
'End of every TestCase it's generate End ti
me
If(ObjFSO.FileExists(strLogFileName) And bl
nNewResult = False) Then
objTxtFile.WriteLine "End Time:" & vbT
ab & objDateTime.Now.toString("MM/dd/yyyy hh:mm:ss
tt")
objTxtFile.WriteLine ""
End If
'At the time of new TestCase starts
objTxtFile.WriteLine "Test Case Name: " & v
bTab & strMATCName
strOSInfo = Environment("LocalHostName") &
" " & Environment("OS") & " " & Environment("OSVe
rsion")
objTxtFile.WriteLine "Environment Name: "
32. & vbTab & """" & Trim(Mid(strOSInfo, InStr(1, strO
SInfo, ":") + 1)) & """"
objTxtFile.WriteLine "Start Time:" & vbTab
& objDateTime.Now.toString("MM/dd/yyyy hh:mm:ss
tt")
objTxtFile.WriteLine ""
objTxtFile.WriteLine "S.No" & vbTab & "Sta
tus" & vbTab & "Step Name" & vbTab & "Description"
& vbTab & "Date/Time"
gval_PrevTCName = strMATCName
gval_intLogSNO = 1
End If
'Generate Log messages into text file
objTxtFile.WriteLine gval_intLogSNO & vbTab &
strStatus & vbTab & Replace(Replace(Replace(strSt
epName,VbTab,""),vbCr,""),vbLf,"") & vbTab & Repla
ce(Replace(Replace(StrStepDescription,VbTab,""),vb
Cr,""),vbLf,"") & vbTab & objDateTime.Now.toString
("MM/dd/yyyy hh:mm:ss tt")
gval_intLogSNO = gval_intLogSNO + 1
objTxtFile.Close
Set objTxtFile = Nothing
Set objDateTime = Nothing
Err.Clear
End Sub
'#################################################
##################################################
################
'# Procedure: lpGenerateHtmlReport()
'# This Procedure is used to Generate Html Report
'#
'# Parameters:
'# Input Parameters:N/A
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Generates the HTML report
33. '#
'# Usage:
'# The usage of this Procedure is
'# > Call lpGenerateHtmlReport()
'#################################################
##################################################
##################
Public Function gflpGenerateHtmlReport()
Dim qtApp
Dim qtLibraries
Dim strHTMLReport
Dim intCount
Dim blnFound
Err.Clear
'On Error Resume Next
Dim strExecutionReportPath,strTxtFilePath,strH
tmlFilePath,strDateTime,strTxtFileName,strHtmlFile
Name
'strDateTime = Year(Now) &"-" & Month(Now) & "
-" & Day(Now) & "_" & Hour(Now) & "-" & Minute(Now
) & "-" & Second(Now)
'Execution Report path,Text file name and Html
file name
If(Instr(gval_executionReportPath,":") > 0) The
n
strExecutionReportPath = Split(gval_executi
onReportPath,"ScreenShots")(0)
Else
strExecutionReportPath = Split(gval_execut
ionReportPath,":")(0) & Split(gval_executionReport
Path,"ScreenShots")(0)
End If
'strExecutionReportPath =Environment("execution
ReportPath")
strTxtFileName = gval_reportTxtFileName
strHtmlFileName = gval_htmlReportSuiteName
34. strTxtFilePath = Replace(strExecutionReportPat
h & Chr(92) & strTxtFileName & ".txt","","")
strHtmlFilePath = Replace(strExecutionReportPa
th & Chr(92) & strHtmlFileName & ".html","","")
'Loading the Report the HTMLReport.QFL file at
run time
blnFound=True
' Set qtApp = CreateObject("QuickTest.Application
")
' Set qtLibraries = qtApp.BusinessComponent.Setti
ngs.Resources.Libraries
' 'Set qtLibraries = qtApp.Test.Settings.Resource
s.Libraries
' For intCount = 1 To qtLibraries.Count
' If InStr(UCase(qtLibraries.Item(intCount)),
UCase("Generic.qfl")) > 0 Then
' blnFound=True
' strHTMLReport = Replace(qtLibraries.It
em(intCount),"Generic.qfl","HtmlReport.qfl")
' Call LoadFunctionLibrary(strHTMLReport)
' Exit For
' End If
' Next
strHTMLReport = "[QualityCenterResources] Reso
urcessap-automationlibHtmlReport.qfl"
Call LoadFunctionLibrary(strHTMLReport)
If blnFound=True Then
'initialize Html Report
Call lpInitializeHtmlReport(strTxtFilePath,
strHtmlFilePath)
End If
'Execution Result Upload to QC
'Call gfUpLoadAttachmentToQC(strHtmlFilePath)
Err.Clear
End Function
35. '#################################################
##################################################
##################
'# Function: gfGetExcelRecordSet(ByVal strExcelFil
eName, ByVal strSheetName, ByVal strWhereClause,
ByRef ObjADORecordSet, ByVal blnReadOnly)
'# Reads the data from excel and populates a record
set
'#
'# Parameters:
'# Input Parameters:
'# strExcelFileName - Excel file name with path or
QTP relative path
'# strSheetName - Excel Sheet name
'# strWhereClause - Where Clause with or without co
nditions
'# blnReadOnly - True/False (User True when you ne
ed to update the RecordSet else use False)
'#
'# OutPut Parameters:
'# ObjADORecordSet - ADODB RecordSet Object is retu
rned
'#
'# Remarks:
'# Path of the Excel file can be a relative path l
ike "....Test.xls" or actual path "C:Test.xls"
'# This Procedure will create a valid sql statement
internally
'# "Where" clause need not be entered in the Where
Condition, Procedure will interally append "Where
" to the sql statement
'# This Procedure will return an ADODB RecordSet a
nd avail the advantages of ADODB RecordSet like Mo
veNext, MoveFirst, MoveLast etc.,
'#
'#
'# Usage:
'# The usage of this Procedure is
'#
'# Example 1: Using below code you can open the fil
e for updaing any row based
'# Call gfGetExcelRecordSet("..TestDataSample.xl
36. s","Sheet1","ID=20",ObjADORecordSet,False)
'# ObjADORecordSet("ScriptStatus") = "True" 'Updat
es the field 'ScriptStatus' with 'True' in the exc
el Sheet
'# ObjADORecordSet.Update
'# objRS.Close
'#
'# Example 2: Below code will get the ADODB recored
set in read-only mode
'# Call gfGetExcelRecordSet("..TestDataSample.xls
","Sheet1","ID=20",ObjADORecordSet,True)
'# Do While Not ObjADORecordSet.EOF
'# msgbox ObjADORecordSet.Fields(0).Value
'# ObjADORecordSet.MoveNext
'# Next
'#################################################
##################################################
##################
Public Function gfGetExcelRecordSet(ByVal strExcel
FileName, ByVal strSheetName, ByVal strWhereClaus
e, ByRef ObjADORecordSet, ByVal blnReadOnly)
'Local variable declarations
Dim strQuery 'Stores SQL Query
Dim ObjCon 'ADO Connection Object
Dim strConvExcelFile
Dim gCnstExcelConnString
Dim strExcelFilePath
Dim qtApp
Dim strFuncName 'Procedure Name is stored for d
isplaying the Fail error message details
strFuncName = "Error in gfGetExcelRecordSet():"
'Download TestData Attachement
' If(QCUtil.IsConnected) Then
' Set qtApp = CreateObject("QuickTest.Applica
tion")
' If InStr(qtApp.Test.Location, "[QualityCent
er]") > 0 Then
' strExcelFileName = gfQCAttachmentDownlo
37. ad(strExcelFileName)
' End If
' Set qtApp = Nothing
' End If
If InStr(strExcelFileName, "..") > 0 Then
strConvExcelFile = gfGetRelativePath(strExc
elFileName)
Else
strConvExcelFile = strExcelFileName
End If
'Open the Database connection
Set ObjCon = CreateObject("ADODB.Connection")
If blnReadOnly = False Then
gCnstExcelConnString = "Provider=Microsoft
.Jet.OLEDB.4.0; Data Source=""" & strConvExcelFile
& """;Extended Properties=""Excel 8.0;HDR=Yes"""
'Connection string
Else
gCnstExcelConnString = "Provider=Microsoft
.Jet.OLEDB.4.0; Data Source=""" & strConvExcelFile
& """;Extended Properties=""Excel 8.0;HDR=Yes;IME
X=1""" 'Connection string
End If
ObjCon.Open gCnstExcelConnString
strQuery = "SELECT * FROM [" & strSheetName & "
$]"
If Len(Trim(strWhereClause)) > 0 Then
strQuery = strQuery & " WHERE " & CStr(strW
hereClause)
End If
'Open the record set
Set ObjADORecordSet = CreateObject("ADODB.Recor
dset")
ObjADORecordSet.ActiveConnection = ObjCon
'To set cursortype and locktype to a editing re
cords when flag is flase
If blnReadOnly = False Then
ObjADORecordSet.CursorType = 3
'Static cursor.
ObjADORecordSet.LockType = 2
38. 'Pessimistic Lock.
End If
ObjADORecordSet.Source = strQuery
ObjADORecordSet.Open
If Not ObjADORecordSet.EOF Then
ObjADORecordSet.MoveFirst
Else
Call gfExitAction(strFuncName , "No Records
found")
End If
End Function
'#################################################
##################################################
##################
'# Function: gfGetDBRecordSet_Wait(ByVal strConStr
ing, ByVal strQuery, ByRef ObjRecordSet, ByVal int
TryTimes, ByVal blnWaitForRecordSet)
'# Procedure used to Check for the existence of ass
et in database for specified time
'#
'# Parameters:
'# Input Parameters:
'# strConString - name of server
'# strQuery - valid "Select" Statement
'# ObjRecordSet - returns the record set value if a
sset exists in database
'# intTryTimes - Tries to get the record set for Nu
mber of times
'# blnWaitForRecordSet - Boolean value (True/False)
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# This Procedure checks for the existence/non- ex
istence of asset in database for valid "Select" st
atement.
'# If blnWaitForRecordSet is passed as true, Proce
dure checks for the existence of asset in database
and
39. '# if blnWaitForRecordSet is passed as false, Proc
edure checks for the non-existence of asset in dat
abase for specified time.
'#
'# Usage:
'# The usage of this Procedure is
'# intResult = f_ GetDBRecordSet_Wait ("DRIVER={IB
M DB2 ODBCDRIVER};UID=devsqs7;PWD=lowes@48;AUTHENT
ICATION=SERVER;PORT=3910;HOSTNAME=DB2GWT;PROTOCOL=
TCPIP;DATABASE=DB2DSNQ;", "Select display_name Fro
m test_rep_1_1 Where displayname ='AssetNew1'" , s
trReturnRecSet,60,True)
'#################################################
##################################################
##################
Public Function gfGetDBRecordSet_Wait(ByVal strCon
String, ByVal strQuery, ByRef ObjRecordSet, ByVal
intTryTimes, ByVal blnWaitForRecordSet)
'Variable Declarations
Dim objCon
Dim ObjADORecordSet
Dim intSeconds
Dim blnFalg
Dim strFuncName 'Procedure Name is stored for d
isplaying the Fail error message details
Err.Clear
strFuncName = "Error in gfGetDBRecordSet_Wait()
:"
On Error Resume Next
'Variable assignment
gfGetDBRecordSet_Wait = False
blnFalg = False
If intTryTimes= 0 Then
intTryTimes = 1
End If
'Decrypt Password and rebuild connection string
strConString=gpBuildConnectionstring(strConStri
ng)
40. For intSeconds = 1 To intTryTimes
Set objCon = CreateObject("ADODB.Connection
")
Set ObjADORecordSet = CreateObject("ADODB.R
ecordSet")
objCon.ConnectionString = strConString
objCon.CommandTimeout = 3000
objCon.Open
'ObjADORecordSet.CursorType = adOpenStatic
ObjADORecordSet.Open strQuery, objCon
If Err.Number <> 0 Then
On Error GoTo 0
Call gfExitAction(strFuncName , "Unable
to execute the query :" & strQuery)
ElseIf (blnWaitForRecordSet =True And Not
ObjADORecordSet.EOF) Or (blnWaitForRecordSet = Fa
lse And ObjADORecordSet.EOF) Or blnWaitForRecordSe
t = "" Then
Set ObjRecordSet = ObjADORecordSet
gfGetDBRecordSet_Wait = True
blnFalg = True
Exit For
End If
Wait(1)
Set ObjADORecordSet = Nothing
Set objCon = Nothing
Next
If blnFalg = False Then
On Error GoTo 0
Call gfExitAction(strFuncName , "Unable to
execute the query :" & strQuery)
End If
Set objCon = Nothing
End Function
'#################################################
##################################################
41. ################
'# Function: gfUpLoadAttachmentToQC(ByVal strResult
FilePath)
'# Function is used to upload attachement to QC
'#
'# Parameters:
'# Input Parameters:
'# strResultFilePath - Path of the file to upload t
o QC
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Returns True/False
'#
'# Usage:
'# The usage of this Procedure is
'# strStatus = gfUpLoadAttachmentToQC(strResultFile
Path)
'#################################################
##################################################
##################
'Private Sub lfUpLoadAttachmentToQC(ByVal strResult
FilePath)
'
' Err.Clear
'
' Dim objAttachmentFactory,ObjAttachItem
' Dim strFuncName 'Procedure Name is stored for d
isplaying the Fail error message details
'
' strFuncName = "Error in gfUpLoadAttachmentToQC(
):"
'
' 'Upload Attachment to Quality Center
' Set objAttachmentFactory = QCUtil.CurrentTestSe
tTest.Attachments
' Set ObjAttachItem = objAttachmentFactory.AddIte
m(Null)
' ObjAttachItem.FileName = strResultFilePath
' ObjAttachItem.Type = 1
' ObjAttachItem.Post
42. ' ObjAttachItem.Refresh
'
' Set objAttachmentFactory = Nothing
' Set ObjAttachItem = Nothing
'
' If(Err.Number<>0) Then
' Err.Clear
' End If
'End Sub
'
'''###############################################
##################################################
##################
''# Function: gfGetWeekdayDate(ByRef strDate)
''# Function is used to get the next available wor
king day date if the delivery date falls under wee
kend
''#
''# Parameters:
''# Input Parameters:
''# strDate - Date falls under weekend
''#
''# Remarks:
''# Returns next available working day date
''#
''# Usage:
''# The usage of this Procedure is
''# > strResult = gfGetWeekdayDate(strDate)
''################################################
##################################################
###################
'Public Function gfGetWeekdayDate(ByRef strDate)
' Dim dtThanksgiving
'
' 'Validating for Thanks giving day and fetching
last thursday of November
' If Month(strDate)=11 Then
' dtThanksgiving=DateAdd("d",-1,Cdate(Cstr(M
onth(strDate)+1)&"/01/"&Year(strDate)))
' For intLoop = 30 To 20 Step -1
' If Weekday(dtThanksgiving)=5 Then Exit
For
43. ' dtThanksgiving=DateAdd("d",-1,dtThanksg
iving)
' Next
' End If
' 'Validating for Thanks giving day and christmas
and adding a day to Estimated date
' 'if the estimated date falls on thanks giving o
r Christmas
' If DateDiff("d",dtThanksgiving,strDate)=0 Or
(Day(strDate)=25 And Month(strDate)=12) Then
' strDate=DateAdd("d", 1,strDate)
' End If
' 'Vaildating and adding days to estimated date i
f it falls on saturday or Sunday
' If WeekDayName(WeekDay(strDate)) = "Saturday" T
hen
' strDate = DateAdd("d", 2,strDate)
' ElseIf WeekDayName(WeekDay(strDate)) = "Sunday"
Then
' strDate = DateAdd("d", 1,strDate)
' End If
'End Function
'#################################################
##################################################
################
'# Function: gfCloseApplication(ByVal strApplicatio
nExeName)
'# Function is used to Kill the Exceed Application
'#
'# Parameters:
'# Input Parameters:
'# strApplicationExeName - Name of the Applicatio
n
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# None
'#
'# Usage:
'# The usage of this procedure is
44. '# > Call gfCloseApplication("hostex32.exe")
'#################################################
##################################################
################
Public Function gfCloseApplication(ByVal strApplica
tionExeName)
Dim strComputer
Dim objWMIService
Dim colProcesses
Dim objProcess
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & s
trComputer & "rootcimv2")
Set colProcesses = objWMIService.ExecQuery ("S
elect * from Win32_Process Where Name = '" & strAp
plicationExeName & "'")
For Each objProcess In colProcesses
objProcess.Terminate()
Next
Set objWMIService = Nothing
Set colProcesses = Nothing
End Function
'#################################################
##################################################
################
'# Function: lpDeleteFolders()
'# Procuder is used to Delete temperoroy folders
'#
'# Parameters:
'# Input Parameters:None
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# None
'#
'# Usage:
'# The usage of this procedure is
'# > Call lpDeleteFolders()
'#################################################
45. ##################################################
################
Private Sub lpDeleteFolders()
Dim objFSO
Dim strTempPath
Dim objFolder
Dim strPath
On Error Resume Next
Set objFSO= CreateObject("Scripting.FileSystemO
bject")
strTempPath=Environment.Value("SystemTempDir")
Set objFolder = objFSO.GetFolder(strTempPath)
For Each objFolder In objFolder.SubFolders
' Note : Only use *lowercase* letters in th
e folder names below:
If Instr(UCase(objFolder.Name),Ucase("Tempo
rary Directory 1"))>0 Then
strPath=objFolder.Path
objFSO.DeleteFolder strPath,True
End If
Next
On Error goto 0
End Sub
'#################################################
##################################################
################
'# Procedure : lpCloseAllDialogs
'# Closes all the Dialogs
'#
'# Parameters:
'# Input Parameters : N/A
'# Output Parameters: N/A
'#
'# Usage:
'# usage of this procedure is
'# > call lpCloseAllDialogs()
'#################################################
##################################################
################
Private Sub lpCloseAllDialogs()
Dim numDialogElems
46. Dim DialogElements
Dim oDesc
Dim inti
' Reporter.Filter = 3
Set oDesc = Description.Create()
oDesc("micclass").Value = "Dialog"
Set DialogElements = Desktop.ChildObjects(oDesc
)
For inti = 0 to DialogElements.Count - 1
If DialogElements(inti).GetROProperty("ena
bled") = True and Len(Trim(DialogElements(inti).Ge
tROProperty("text")))>0 Then
On Error Resume Next
DialogElements(inti).Close
Wait(1)
End If
Next
Err.Clear
' Reporter.Filter = 0
End Sub
'#################################################
##################################################
################
'# Function: gfGetScriptVariablesData(ByVal strExc
elFilePath,ByVal strScriptName,ByRef ObjADORecordS
et)
'# This Procedure retrieves the test data for a sp
ecific test script from Test Data location
'#
'# Parameters:
'# strExcelFilePath - Excel file path
'# strScriptName - Name of the script
'#
'# OutPut Parameters:
'# N/A
'#
'# Function Return Value:
'# True/False indicating the Successful execution o
f the Procedure.
'#
47. '# True-Successful, False-Unsuccessful
'#
'# Remarks:
'# Script Name is not Mandatory you can send empty
"" as parameter and the Procedure will take the C
urrent Script Name by Default
'#
'# Usage:
'# Below is the example to search and add asset in
'Browse' tab
'#
'# Call gfGetScriptVariablesData("........Test
DataSampleTestData.xls",Trim(Left(Environment.Va
lue("ActionName"),Len(Environment.Value("ActionNam
e"))-Instr(1,Environment.Value("ActionName"),"["))
),objRs)
'# strProjectDescription = objRs.Item("strProjectDe
scription")
'# strDefaultDisplayName = objRs.Item("strDefaultDi
splayName")
'#################################################
##################################################
################
Public Function gfGetScriptVariablesData(ByVal str
ExcelFilePath,ByVal strScriptName,ByRef ObjADOReco
rdSet)
Dim objRsAct 'Record set object
Dim intCounter 'Loop counter
Dim intColCnt 'Stores Column Coun
t
Dim intCurrColCnt 'Stores Current Col
Count
Dim strFuncName 'Stores Procedure N
ame
Dim arrTempContent 'Array to store Mod
ule Name
strFuncName = "Error in gfGetScriptVariablesDat
a():"
Set ObjADORecordSet=CreateObject("ADODB.records
48. et")
arrTempContent=Split(strScriptName,"_")
If Len(Trim(strScriptName)) = 0 Then
strScriptName = Trim(Left(Environment.Valu
e("ActionName"),Len(Environment.Value("ActionName"
))-Instr(1,Environment.Value("ActionName"),"[")))
End If
Call gfGetExcelRecordSet(strExcelFilePath,arrT
empContent(1),"TestScriptName='" & strScriptName &
"'",objRSAct,True)
Set ObjADORecordSet = CreateObject("ADODB.Recor
dset")
intCounter = 0
intColCnt = 0
Do while Not objRSAct.EOF
If intCounter = 0 Then 'Reading the First
Row and preparing RecordSet Fields
For intColCnt = 1 To objRSAct.Fields.Co
unt-1
If Trim(objRSAct.Fields(intColCnt).
value & "") = "" Then
ObjADORecordSet.Open
Exit For
End If
ObjADORecordSet.Fields.Append Trim
(objRSAct.Fields(intColCnt).value & ""), adVarChar
, 2000
Next
Else
'Adding Data To The Record Set
ObjADORecordSet.AddNew
For intCurrColCnt = 0 To intColCnt-2
ObjADORecordSet.Fields(intCurrColC
nt).Value = Trim(objRSAct.Fields(intCurrColCnt+1).
Value & "")
Next
End If
If Err.Number<>0 Then
On Error GoTo 0
Call gfExitAction(strFuncName , "Unabl
49. e to Create Reporting Folder Structure")
Exit Do
End If
intCounter = intCounter + 1
objRSAct.MoveNext
Loop
If Not ObjADORecordSet.EOF Then
ObjADORecordSet.MoveFirst
End If
Set objRSAct = Nothing
End Function
'#################################################
##################################################
################
'# Function: gfObjectExists(ByRef objControl)
'# Function used to verify whether required object
is exists or not
'#
'# Parameters:
'# Input Parameters:
'# objControl - Object to be verified
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Verifies the Object existence, If objControl pa
rameter is empty then reports the failure mesage w
ith appropriate message
'# Waits for the Object until elapsed time is great
er than gTIMEOUT = 60 Sec
'#
'# Usage:
'# The usage of this function is
'# strStatus = gfObjectExists(Browser("brSOSDesign
Tools").Page("pgProductPage").WebElement("weDirect
Search"))
'#################################################
##################################################
##################
Public Function gfObjectExists(ByRef objControl)
50. Err.Clear
Dim objExistenceTimer
Dim strFuncName 'Function Name while displaying
the Fail error message details
strFuncName = "Error in gfObjectExists():"
gfObjectExists = False
'Re-identify the object in the application the
next time a step refers to this object
'objControl.RefreshObject
'check whether objControl is Empty or not
If(IsEmpty(objControl)) Then
gfReportExecutionStatus micFail,strFuncName
,"Object is Empty"
Exit Function
ElseIf objControl Is Nothing Then
gfReportExecutionStatus micFail,strFuncName
,"Object is not found"
Exit Function
'check whether objControl is Object or not
ElseIf(Not(IsObject(objControl)))Then
gfReportExecutionStatus micFail,strFuncName
,"In Parameter is not an object"
Exit Function
End If
'Call gfSyncApplication(objControl.GetROPropert
y("micClass"))
'check whether object objControl is exists or n
ot
Set objExistenceTimer = MercuryTimers.Timer("Ob
jectExists")
objExistenceTimer.Start
Do
If(objControl.Exist(gSHORTWAIT)) Then
gfObjectExists = True
If(Not((objControl.GetROProperty("micC
lass")="WinEdit") OR (objControl.GetROProperty("mi
51. cClass")="WinButton") Or (objControl.GetROProperty
("micClass")="Dialog")Or (objControl.GetROProperty
("micClass")="WinListView")Or (objControl.GetROPro
perty("micClass")="Window")Or gfRegExpExecute("Te*
",True, objControl.GetROProperty("micClass")))) Then
objControl.MakeObjVisible()
End If
Exit Do
End If
Wait CInt(gDELAYINTERVAL)
Loop Until ((objExistenceTimer.ElapsedTime)/100
0) > CInt(gTIMEOUT)
objExistenceTimer.Stop
Set objExistenceTimer=Nothing
'Check and Report Runtime Errors If any
If (Err.Number<>0) Then
Call gfReportExecutionStatus(micFail,strFu
ncName,"Run Time Error Details : " & Chr(34) & str
FuncName & Err.Description & Chr(34))
Err.Clear
End If
End Function
'#################################################
##################################################
################
'# Function: gfIsEnabled(ByVal objControl)
'# Function used to check objectControl is Enabled
or Not
'#
'# Parameters:
'# Input Parameters:
'# objControl - Object on which action to be perfor
med
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
52. '# Verifies whether the object is enabled returns T
rue if exist else false
'#
'# Usage:
'# The usage of this function is
'# blnStatus = gfIsEnabled(Browser("brSOSDesignToo
ls").Page("pgProductPage").Webbutton("btnSearch"))
'#################################################
##################################################
################
Public Function gfIsEnabled(ByVal objControl)
Err.Clear
Dim strFuncName 'Function Name is stored for d
isplaying the Fail error message details
strFuncName = "Error in gfIsEnabled():"
'Re-identify the object in the application the
next time a step refers to this object
'objControl.RefreshObject
gfIsEnabled = False
If (objControl.GetROProperty("disabled") = 0) T
hen
gfIsEnabled = True
End If
'Check and Report Runtime Errors If any
If (Err.Number<>0) Then
Call gfReportExecutionStatus(micFail,strFu
ncName,"Run Time Error Details : " & Chr(34) & str
FuncName & Err.Description & Chr(34))
Err.Clear
End If
End Function
'#################################################
##################################################
53. ################
'# Function: lfToString(ByRef objControl)
'# Function used to display ObjectName
'#
'# Parameters:
'# Input Parameters:
'# objControl - Action to be performed
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'#
'# Usage:
'# The usage of this function is
'# > Call lfToString(objControl)
'#################################################
##################################################
##################
Private Function lfToString(ByRef objControl)
Err.Clear
Dim strFuncName 'Function Name is stored for d
isplaying the Fail error message details
strFuncName = "Error in lfToString():"
Dim Properties,intPropertiesCount,arrProperties
(),i
If objControl Is Nothing Then
Exit Function
End If
'If Dp is used then retrive all property names
and values
If(Trim(Split(objControl.ToString," ")(0))="[")
Then
Set Properties = objControl.GetTOProperties
intPropertiesCount = Properties.Count
ReDim arrProperties(intPropertiesCount - 1
)
For i = 0 To intPropertiesCount - 1
arrProperties(i)=Properties(i).Name & "
54. :" & Properties(i).Value
Next
lfToString = Join(arrProperties,",")
Else
'If Object is in OR
lfToString = Trim(objControl.GetTOProperty(
"TestObjName"))
End If
'Check and Report Runtime Errors If any
If (Err.Number<>0) Then
Call gfReportExecutionStatus(micFail,strFu
ncName,"Run Time Error Details : " & Chr(34) & str
FuncName & Err.Description & Chr(34) )
Err.Clear
End If
End Function
'#################################################
##################################################
##################
'# Function: gfGetRelativePath(ByVal strUploadedFil
eName)
'# Function used to Get actual path from the relati
ve path of QTP
'#
'# Parameters:
'# Input Parameters:
'# strUploadedFileName - QTP Relative path as strin
g
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Returns string with the actual path from the fun
ction
'#
'# Usage:
'# The usage of this function is
'# strActPath = f_GetRelativePath(strRelPath)
'#################################################
##################################################
55. ##################
Public Function gfGetRelativePath(ByVal strUploaded
FileName)
Dim strTemp
gfGetRelativePath = ""
If InStr(strUploadedFileName, "..") = 0 Then
gfGetRelativePath = strUploadedFileName
Exit Function
End If
If Len(Trim(strUploadedFileName)) =0 Then
Exit Function
End If
If PathFinder.Locate(strUploadedFileName) = ""
Then
strUploadedFileName = ".." & strUploadedFi
leName
End If
strUploadedFileName = PathFinder.Locate(strUplo
adedFileName)
If InStr(strUploadedFileName, "") > 0 Then
strTemp = Replace(Mid(strUploadedFileName,3
), "", "")
If Left(strUploadedFileName,2) = "" Then
strUploadedFileName = "" & strTem
p
End If
End If
gfGetRelativePath = strUploadedFileName
End Function
'#################################################
##################################################
##################
'# Function: gfDBExecuteSQLQuery(ByVal strConnectio
nString, ByVal strQuery)
'# Function used to Execute SQL statement against
database if Zero records are affected it will retu
rn False else True
'#
'# Parameters:
56. '# Input Parameters:
'# strConnectionString - Connection String object
'# strQuery - valid select query
'#
'# OutPut Parameters: N/A
'#
'# Remarks:
'# Verifies database for mentioned select query
'#
'# Usage:
'# The usage of this function is
'# intResult = gfDBExecuteSQLQuery("Delete From [Ta
ble-name] Where [where condition]")
'#################################################
##################################################
##################
Public Function gfDBExecuteSQLQuery(ByVal strConnec
tionString, ByVal strQuery)
Err.Clear
'Variable Declarations
Dim objCon
Dim intRecordsAffected
Dim strFuncName 'Function Name is stored for d
isplaying the Fail error message details
strFuncName = "Error in gfDBExecuteSQLQuery():"
On Error Resume Next
'Variable assignments
gfDBExecuteSQLQuery = False
Set objCon= CreateObject("ADODB.Connection")
'Decrypt Password and rebuild connection string
strConnectionString=gfBuildConnectionstring(str
ConnectionString)
objCon.ConnectionString = strConnectionString
objCon.Open
objCon.CommandTimeout = 3000
intRecordsAffected = 0
objCon.Execute strQuery,intRecordsAffected
57. If Err.Number <> 0 Then
On Error GoTo 0
Call gfExitAction(strFuncName , "Unable to
execute the query :" & strQuery)
End If
If intRecordsAffected > 0 Then
gfDBExecuteSQLQuery=True
End If
Set Conn = Nothing
End Function
'#################################################
##################################################
################
'# Function: gfGetTestScriptPath(ByVal strRelativeP
ath)
'# Function is used to get the path of the TestScri
pt
'#
'# Parameters:
'# Input Parameters:
'# strRelativePath - Upto which level Path to be re
trieved
'#
'# Remarks:
'# Returns TestScript Path
'#
'# Usage:
'# The usage of this function is
'# > strScriptPath = gfGetTestScriptPath("....")
'#################################################
##################################################
##################
Public Function gfGetTestScriptPath(ByVal strRelati
vePath)
Dim qtpApp '
Dim arrPath
Dim strPath
Dim intCnt
Dim strFuncName 'Function Name is stored for d
isplaying the Fail error message details
58. strFuncName = "Error in gfGetTestScriptPath():"
'Create the Quicktest object
Set qtpApp = CreateObject("QuickTest.Applicatio
n")
'Retrieve the Path of the test
strPath = qtpApp.Test.Location
'Reduce the number of levels in the path based
on the parameter
If Len(Trim(strRelativePath))>0 Then
arrPath = Split(strPath, "")
strPath = ""
For intCnt =0 To UBound(arrPath)-UBound(Spl
it(strRelativePath,""))
strPath = strPath & arrPath(intCnt) & "
"
Next
End If
gfGetTestScriptPath= strPath
End Function
'#################################################
##################################################
################
'# Function: gfNumberFormat(ByVal intNumber,ByVal s
trFormat)
'# Function is used to get the number formatted as
required
'#
'# Parameters:
'# Input Parameters:
'# strRelativePath - Upto which level Path to be re
trieved
'#
'# Remarks:
'# Returns String in the required format
'#
'# Usage:
'# The usage of this function is
'# strDay = gfNumberFormat(Day(Date),"0000")
'#################################################
##################################################
59. ##################
Public Function gfNumberFormat(ByVal intNumber,ByVa
l strFormat)
Dim strTemp 'Number Formatting
strTemp = CStr(intNumber)
If Len(strTemp) >= Len(strFormat) Then
gfNumberFormat = strTemp
Else
gfNumberFormat = Left(strFormat, Len(strFor
mat)-Len(strTemp)) & strTemp
End If
End Function
'#################################################
##################################################
################
'# Function: gfRegExpExecute(ByVal sPatrn, ByVal bI
gnoreCase, ByVal sString)
'# Function is used to find a regular expression p
attern string in a string which will compare the s
tring and returns True/False if the match is found
with the regular expression pattern
'#
'# Parameters:
'# Input Parameters:
'# sPatrn - String Pattern to be verified
'# bIgnoreCase - Boolean True/False to Ignore strin
g case while verifying
'# sString - String to be verified in
'# Output Parameters: N/A
'#
'# Remarks:
'# For more details on the regular expressions go t
hrough the help document
'#
'# Usage:
'# Below example verifies 'abc100' in the string i
t is compared with a regular expression pattern [a
-z0-9A-Z]+ is a regular expression pattern which w
ill compare with the string and returns true in th
e below case
60. '# blnStatus = gfRegExpExecute("Select This [a-z0-
9A-Z]+% abc",True,"Select This abc100% abc")
'#################################################
##################################################
##################
Public Function gfRegExpExecute(ByVal sPatrn, ByVal
bIgnoreCase, ByVal sString)
Dim oRegEx ' Create variable.
Dim oMatches
gfRegExpExecute = False
Set oRegEx = New RegExp ' Create regular expres
sion.
oRegEx.Pattern = sPatrn ' Set pattern.
oRegEx.IgnoreCase = bIgnoreCase ' Set case inse
nsitivity.
oRegEx.Global = True ' Set global applicability
.
Set oMatches = oRegEx.Execute(sString) ' Execut
e search.
If oMatches.Count>0 Then
gfRegExpExecute = True
End If
End Function
'#################################################
##################################################
##################
'# Function: gfGetROProperty(ByRef objControl,ByVal
strPropertyName)
'# This Function is used to Get the ROProperty of g
iven ObjectControl
'#
'# Parameters:
'# Input Parameters:
'# objControl - Object on which action to be perfor
med
'# strPropertyName - Property Name of ObjControl
'# OutPut Parameters: N/A
'#
'# Remarks:
'# This Function is used to Get the ROProperty
'#
61. '# Usage:
'# The usage of this function is
'# strProprtyVal = gfGetROProperty(Browser("brSOSD
esignTools").Page("pgProductPage").WebList("lstSea
rchBy"),"title")
'#################################################
##################################################
##################
Public Function gfGetROProperty(ByRef objControl,By
Val strPropertyName)
Err.Clear
Dim strTestObjectName
Dim strFuncName
gfGetROProperty = ""
strFuncName = "Error in gfGetROProperty():"
gfGetROProperty=""
strTestObjectName = lfToString(objControl)
'check whether object objControl is exists or n
ot
If (gfObjectExists(objControl)) Then
gfReportExecutionStatus micDone, strFuncNa
me,"Object [" & strTestObjectName & "] is Exists"
'Get the RO Property of given object contro
l
gfGetROProperty = Trim(objControl.GetROProp
erty(strPropertyName))
Else
'If objControl is not found then Exit from
current Action
On Error GoTo 0
Call gfExitAction(strFuncName , "Object ["
& strTestObjectName & "] dose not Exist")
End If
'Check and Report Runtime Errors If any
If (Err.Number<>0) Then
Call gfReportExecutionStatus(micFail,strFu
ncName,"Run Time Error Details : " & Chr(34) & str
62. FuncName & Err.Description & Chr(34))
Err.Clear
End If
End Function
'#################################################
##################################################
################
'# Function: gfEncryptString(ByVal strPassword)
'# Function is used to encrypt the given string and
copy the encrypted sting to clipboard
'#
'# Parameters:
'# Input Parameters:
'# strPassword - Password to Encrypt
'# OutPut Parameters:
'# Returns the encrypterd string
'# Remarks:
'# Use this function to encrypt the password
'#
'# Usage:
'#
'# Call gfEncryptString("Password")
'#################################################
##################################################
################
Public Function gfEncryptString(ByVal strPassword)
Dim strChar
Dim intLoop
Dim strtmp
Dim objClipboard
For intLoop = 1 To Len( strPassword)
strChar = Mid( strPassword, intLoop, 1 )
strtmp = strtmp & Chr( Asc( strChar ) + Env
ironment.Value("SeedValue") )
Next
Set objClipboard=CreateObject("Mercury.Clipboar
d")
objClipboard.Clear
63. objClipboard.SetText Replace(StrReverse( strtmp
), "&",Environment.Value("MaskValue"))
Msgbox "The Encrypted password has been copied
to clipboard"
End Function
'#################################################
##################################################
################
'# Function: gfDecryptString(ByVal strPassword)
'# Function is used to Decrypt the encrypted string
using gfEncryptString function
'#
'# Parameters:
'# Input Parameters:
'# strPassword - Password to Decrypt
'# OutPut Parameters:
'# Returns the decrypted string
'# Remarks:
'#
'#
'# Usage:
'#
'# Call gfDecryptString("Password")
'#################################################
##################################################
################
Public Function gfDecryptString(ByVal strPassword)
Dim strChar
Dim intLoop
Dim strtmp
strPassword = Replace(strPassword,Environment.V
alue("MaskValue"),"&")
For intLoop = 1 To Len( strPassword)
strChar = Mid( strPassword, intLoop, 1 )
strtmp= strtmp & Chr( Asc( strChar) - Envir
onment.Value("SeedValue"))
Next
gfDecryptString= StrReverse( strtmp)
End Function
'#################################################
64. ##################################################
################
'# Function: gfBuildConnectionstring(ByRef strConne
ctionString)
'# Function is used to build the connection string
with Decrypted password
'#
'# Parameters:
'# Input Parameters:
'# strPassword - Password to Decrypt
'# OutPut Parameters:
'# Returns the decrypted string
'# Remarks:
'#
'# Usage:
'# Call gfDecryptString("Password")
'#################################################
##################################################
################
Public Function gfBuildConnectionstring(ByRef strCo
nnectionString)
Dim arrPart
arrPart=Split(Split(strConnectionString,"PWD=")
(1),";")
arrPart(0)=gfDecryptString(arrPart(0))
strConnectionString=Split(strConnectionString,
"PWD=")(0)& "PWD="& Replace(Join(arrPart)," ",";")
gfBuildConnectionstring=strConnectionString
End Function
'#################################################
##################################################
################
'# Function: gfFormatDate(ByVal strDateTime, ByVal
strFormat)
'# Converts date as per the specified format
'#
'# Parameters:
'# strDateTime - Date Time string
'# strFormat - Format to which the date time need t
o be converted
'#
65. '# Function Return Value:
'# Returns the date converted to specified format.
'#
'# Remarks:
'# -NA-
'#
'# Usage:
'# Below is the example to retrieve DateTime covert
ed to a specific format
'#
'# strNewDate = gf_date (now(), "yyyy-mm-dd")
'#
'# strNewDate = gf_date (time(), "hh:mm")
'#
'#################################################
##################################################
################
Public Function gfFormatDate(ByVal strDateTime, ByV
al strFormat)
Dim objFmt 'StdDataFormat object
Dim ObjADORecordSet 'Resultset object
Dim strFuncName 'Function Name is stored for d
isplaying the Fail error message details
strFuncName = "Error in gfFormatDate():"
On Error Resume Next
set objFmt = CreateObject("MSSTDFMT.StdDataForm
at")
objFmt.Format = strFormat
set ObjADORecordSet = CreateObject("ADODB.Recor
dset")
ObjADORecordSet.Fields.Append "fldExpression",
12
ObjADORecordSet.Open
ObjADORecordSet.AddNew
set ObjADORecordSet("fldExpression").DataFormat
= objFmt
ObjADORecordSet("fldExpression").Value = strDat
66. eTime
gfFormatDate = ObjADORecordSet("fldExpression")
.Value
ObjADORecordSet.close
Set ObjADORecordSet = Nothing
Set objFmt = Nothing
If Err.Number <> 0 Then
On Error GoTo 0
Call gfExitAction(strFuncName , "Unable to
format the provided date:" & strDateTime & " Erro
r:" & Err.Description)
End If
End Function
'#################################################
##################################################
################
'# Function: gfSyncApplication(ByVal strmicClassNam
e)
'# Sync's the application based on the object sent
'#
'# Parameters:
'# Input Parameters:
'# strmicClassName - Object MicClass should be sent
'#
'# Remarks:
'# -NA-
'#
'# Usage:
'# Below is the example to Sync the application
'# Call gfSyncApplication(objControl.GetROProperty(
"micClass"))
'#################################################
##################################################
################
Public Function gfSyncApplication(ByVal strmicClass
Name)
67. Select Case strmicClassName
'Web Application Sync
Case "WebButton","Link","Image","WebElemen
t","WebRadioGroup","WinButton","WebCheckBox"
Call gfBrowserSync()
'Case :To-Do For TE,SAP etc., Application
End Select
End Function