Professional Documents
Culture Documents
Power consists in one’s capacity to link his will with the purpose of others, to lead by reason
and a gift of cooperation. Woodrow Wilson
abhinav@indiantestingboard.com
Author’s Name: Abhinav Vaid
Free Software Foundation (FSF)
www.indyacellular.in
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
This is to declare that whatever has been produced in the book has entirely been my own
effort and research.1 And there has been no disclosure of Confidential Information from my
present/previous employers.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Dedication:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Foreword:
The topic has a vast coverage on Test Automation, taking up real code examples, so that the
engineer/tester himself has a privilege to decide as to what is good and makes sense as per
his/her Test Development/Automation requirements. Test Automation in itself is extremely
vast field, and Abhinav in has book has made a serious attempt to touch each and every
aspect and has succeeded.
Abhinav Vaid is professionally as well as personally known to me and has good command over
the subject. He was involved extensively in Test Automation related activities when we
worked together for a couple of years as a part of Motorola India Design Center.
Rajesh Tibrewala
Technology Lead, .Net, Microsoft India
rajesht@microsoft.com
Abhinav Vaid is professionally known to me, and we have worked together in the past with a
Semiconductor R & D Engineering Center, where Abhinav was heading QA and Product
Release activities. He has an excellent command over the subject.
Dr Vivek Mudgil
Senior Product Manager, vmudgil@spatialwireless.com
Alcatel India
Its been almost 12 years since the time I got associated to IT and I have been doing
documentation/ testing/ product release/ dev(mostly scripting related). I have been leading
Release and Test teams from past 5 years. I have worked with RiverRun Software/Motorola
India/McAfee India. Some of the key projects that I have tested and released:
Arm architecture based wireless chipsets with various OS/Interface flavors targeted for
Client(embedded, mobile, & handset) and Gateway markets
· CodeWarrior IDE Pro 6 development Tools for X86
· CodeWarrior IDE Pro 8 development Tools for X86
· CodeWarrior IDE development Tools for ARM based Architectures
· CodeWarrior IDE for eLinux
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
· BSP's for ARM 9 Line of processors on all the embedded OS'es SP, WinCE, Symbian 7 to
8.0b
· Middleware Apps for ARM line of processors (include video and audio codecs)
· McAfee GroupShield 5.0
· McAfee GroupShield 5.2
· McAfee GroupShield 6.0 followed by patch release
· CDMA Based Wireless PCO Terminal, first live implementation in India
Technical Background:
B.Tech. in Electronics and Communications
Microsoft Certified Professional (MCP)
Microsoft Internet Specialist
Microsoft Certified Software Engineer
Certified Software Test Engineer
ISTQB Certified Test Engineer—Foundation level
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Assumptions:
I have assumed that the end user (a Test Engineer or an Automation Engineer) has some
level of OS knowledge and has done some programming/testing in the past.
1. Target Audiences:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
1. There were bugs in code as well as language, which have been fixed in this version.
2. There were various suggestions, inputs from various sources which I have tried to
incorporate (which made sense to me and gave me time to do so). Most of it is the latest
Windows Flavors in the market today.
Evaluating some of the most popular Test Automation Tools, and why do they fail,?
Misleading promises by the Tool Vendors have always costed a lot to the
Organizations, and still does not deliver what it is supposed to. Why do
Organizations buy the expensive test automation tools and later regret,when
they are not been able to justify the ROI.
The Book has gone into Operating System Internals(only from the Testing and Automation
perspective), and the inherent engines that support Test Automation. Explains the
background insights as to what happens when you automate an application, how do the test
automation tools handle it and what is the suggested workarounds to make them generic
enough so that it works across across platforms removing the dependencies.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
The book has taken a couple of scripting tools\languages most of them under open source
licensing and automated the same Test Suite(which we did using Test Automation tools using
10 different technologies\languages etc using OS internals which even Test Automation Tools
also use.
Tools and Associated Support Tools which are around for a while and have
penetrated into the space to the extent of
contributions to the Test Engineering
Automation
The highest level aspiration every good tester
Bringing Intelligence in Test
looks forward to; to be a perfectionist.
Automation
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Table of Contents
Chapter1: The Evolution of Software Testing to Test Automation....................................
Automation....................................14
14
Setting up the Stage for Test Automation.................................................................
Automation.................................................................14
14
Test Automation in Embedded Operating Systems.....................................................
Systems.....................................................17
17
Test Automation Linux...........................................................................................
Linux...........................................................................................17
17
Organizing the Grey Matter..........................................................................................
Matter..........................................................................................18
18
Some Higher Level abstracts on Test Automation Tools.................................................
Tools.................................................18
18
Getting into Insights of Test Automation.................................................................
Automation................................................................. 19
Chapter 2 : Evaluating 3rd Party Tools for Test Automation..............................................
Automation..............................................19
19
Evaluating Winrunner for Test Automation..................................................................
Automation.................................................................. 19
How do The Automation Script Engines Work? ..............................................................27
..............................................................27
Evaluating LoadRunner.............................................................................................
LoadRunner.............................................................................................32
32
Evaluating QuickMacros for Test Automation...............................................................
Automation............................................................... 41
Implementation using QuickMacros............................................................................
QuickMacros............................................................................50
50
How Quick Macros works: Insights..........................................................................
Insights..........................................................................58
58
Evaluating QA Run for Test Automation......................................................................
Automation...................................................................... 67
Chapter 3: Touching the OS Internals, insights to make a Test Automation Project a Success..
Success..
69
Architecture Of Microsoft Windows.............................................................................
Windows............................................................................. 69
Windows Kernel - A Brief Primer..............................................................................
Primer..............................................................................72
72
The Changing trend of Partitioning:..........................................................................
Partitioning:..........................................................................73
73
What is COM: And how is it associated with Test Automation ........................................82
........................................82
Chapter 4: Making a Business Case to Build Test Automation: Using 10 different
technologies/languages to do the same Test Automation done using Commercial Test Tools
84
What are Object Models: ......................................................................................95
......................................................................................95
Capturing and Using Objects:.........................................................................
Objects:......................................................................... 95
Automating Office Applications ................................................................................103
................................................................................103
WSH and Test Automation....................................................................................
Automation....................................................................................107
107
Using WSH for Test Automation...............................................................................
Automation............................................................................... 136
Using Windows Scripting Host for Test Automation based on OOPS...............................
OOPS...............................141
141
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Table of Figures
Figure 7.1.: Navigating to WinRunner............................................................................
WinRunner............................................................................20
20
Figure 7.2.: Winrunner Home Page...............................................................................
Page............................................................................... 21
Figure 7.3.: Object handling by the Test Automation Tool ............................................... 28
Figure 7.4.: Winrunner Test Code for Word.application....................................................
Word.application.................................................... 29
Figure 7.5.: UsingWinrunner for Test Automation............................................................
Automation............................................................30
30
Figure 7.6.: ...............................................................................................................32
Figure 7.7.: LoadRunner Installation Screen 2................................................................
2................................................................32
32
Figure 7.8.: LoadRunner Installation Screen 1................................................................
1................................................................32
32
Figure 7.9.: Destination Folder Selection Dialog Box........................................................
Box........................................................33
33
Figure 7.10.: Loadrunner Installation Screen 2...............................................................
2...............................................................34
34
Figure 7.11.: Loadrunner Installation Screen Sample Prompt...........................................
Prompt........................................... 36
Figure 7.12.: First time Invocation Screen gives the error message ..................................37
..................................37
Figure 7.13.: Copying Files Dialog Box..........................................................................
Box.......................................................................... 38
Figure 7.14.: Available Disk Screen...............................................................................
Screen...............................................................................39
39
Figure 7.15.: Param Configuration Screen......................................................................
Screen......................................................................39
39
Figure 7.16.: Registration Confirmation Screen ..............................................................40
..............................................................40
Figure 7.17.: Navigating to QuickMacros........................................................................
QuickMacros........................................................................54
54
Figure 7.18: Error in Test Automation - Office A.............................................................
A............................................................. 57
Figure 7.19.: Sticky Tools and Supportive/Intuitive Interface of The Tool .......................... 69
Figure 7.1.: Installers Tracking and information............................................................
information............................................................187
187
Figure 7.2.: Task Manager Support by Microsoft Windows..............................................
Windows.............................................. 190
Figure 7.3.: Log Generation Support by Microsoft Windows ........................................... 192
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Since the time I started my career, during the old programming days, and I was more
inclined towards Testing more than development. So the background activity that was always
happening was self study of Testing\QA\Automation related books.
An effort to share insights required to Building Automated Test Systems: Cost Effective, and
generic enough to work across platforms in 1st go. Principles behind to make Automation
Project a Success.
There was lot of stuff available on Testing , but not on Test Automation. And whatever I read
with respect to the subject, most of it gave abstract views about how to implement Test
Automation. None of them really talked about the real time practical implementation. I must
have referred to hundreds of urls/technical information sites/technical journals etc., but after
going through tonnes of pages, realized that the real concrete part was of less than10 pages,
which confused me all the more.
To fill in the gaps that existed became the main source of inspiration to go ahead and write
this book.
It starts with the way the Test Automation Tools available in the market work, their benefits
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
and pitfalls. Then goes to the level of explaining as how to do automation in Windows using
various programming/scripting languages, removing all the dependencies. Displays the real
code examples (in various languages for doing the same task), so that the Test/Automation
engineer can himself decide as to what can be best for him.
When the work was nearing the completion, it was covering everything including generation
of automation for all the automation related projects right from OS Windows to Linux, and
then Embedded systems also. The idea was to address most of the audiences that we have
(which even had a some small implementation AI in “Building Automated Test Systems--
Embedded Systems”.
There were lots of reviews from peers, a couple of Industry Wizards, and of course Publishers,
and there was 1 feedback from all the fronts, i.e., Focus on 1st and do it in phases.
So had to converted it into 3 books and this happens to be the 1st one. The other 2 will/might
come up as a separate books sometime down the line (again in case I get sufficient time to
do so).
The idea was to have a more focused approach, which made a lot of sense to me also.
I have tried to be precise and crisp. With absolutely no abstract views about technical
aspects. Real code examples have been given which have been tested, and successfully
implemented.
Why Automation: As they say “Necessity is the Mother of Invention”. The same fact holds
true for Software Test Automation also. The computing technologies have been moving at
such a rapid pace which result in diverse and complex systems targeted towards various
industry needs.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
In such a scenario, Software Testing becomes all the more critical as 1 code change at 1 place
might result in breaking the system at “n” number of places. Eventually what that means is
that even if there is 1 code change, you need to execute the whole test cycle associated with
product. Now 1 test cycle might take any number of days depending on the coverage that
needs to be achieved. Here automation definitely comes handy, and if it works effectively, the
physical presence of the Test Engineer is not even required. Unfortunately that is not so
simple as it sounds.
Yes, doing intelligent automation/scripting is definitely complicated. But when it works, it is a
different fun altogether. I have tried to cover each and every part of Test Automation for
every type of environment (hw/sw/OS specifics etc).
To make the scripts generic enough so that they work without manual intervention required
to do so. In case it turns the outer way round, it can be really disastrous.
I remember once an application targetted for the web, which was supposed
to handle auto-mailers, and was about to go for a realtime testing. The guy had
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
tested simulating and automating, and using the same script, he used to test
the application in the realtime environment and before he could realize, there
were already 40 thousand mails sent. Imagine, if he had run it before leaving
for the day.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
As I mentioned earlier, this would be coming in as the 3rd volume of the book. There is a
different world out there that in Embedded needs to be addressed/explained. Also these are
the inputs that I received from the various industry experts to make it very specific, targeted
for specific audiences. I am very sure that embedded guys will like it. Personally, to me also
embedded technologies and testing/automation has always been more fun
So what you are going to achieve is Automating the same stuff(Test Cases) using
10 different technologies( Test Tools and/or Scripting languages).
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Why: The objective remains to explore/make the Software Engineers realize, what goes
behind those fancy Test Tools and to what extent that helps/doesn’t help. Workarounds if it
does not help.
Explains as to how most of the commercially available Test Tools in the market work, what
happens right from clicking the Record button to Compiled Script generation. What
happens in the background when the test cases are being recorded. How does the Test Tool
interface with the Windows.
What are the components of the Test Tool interacting with Windows(and which component of
windows) and how.
What are the benefits of Test Tools and what are the pitfalls to checkout for.
Why do the Organizations end up buying the Test Tools and later regret because of non
justification of money spent and also the time lags, R&D efforts spent by the Test Engineers.
Later the Test System itself becoming a different project in itself, making the real objective
itself going for a toss. Although this is a worst case scenario but I have personally seen
happening so many times in some of the most respected brand names in the Industry.
Whatever technical evaluations I have mentioned in the book has come out as a
result of my own experience/research and comes out with my own
understanding of the Test Tools and Scripting Languages associated. It can no
way be taken as a technical claims or otherwise. Technical Redundancy, if any
would be purely co-incidental, as there is no book/journal etc that I have
referred to while writing this book. I have myself tried a lot to find a similar
book/material but could not find any. Yes, there are a couple of url's which
could be handy for the engineers which I have included
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
need monkeys working as laborers, he just needs brains. And make scripts work like monkeys
instead.
It was an interview, and my reply was how soon can I join.
There really is a lot of fun but it comes with a heavy price associated, not monetary but the
time to do R & D to make the project a success. If you aspire to do this, this book is for you.
There might be various copywrite issues associated by putting the insights to the internal
engine and architectural details of the test tools. So I really am not going to that stage, and
from the testers perspective, its not required also. We do not intend to do reverse
engineering, right !!!
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
The basic steps in Test Development/Automation are more or less the Requirements
Specifications which are used for development Team.
Further, the pre requisite before any automation task to do is to execute it once manually so
that the requirement/expectation of the Task is absolutely crystal clear.
1. Invoke WinRunner.
2. The main screen will be displayed as shown in the figure.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
# Start Menu
set_window ("Start
("Start Menu",
Menu", 2);
list_select_item ("Abhinav
("Abhinav Vaid",
Vaid", "Microsoft Office Word 2003");
2003"); # Item
Number 4;
# File_1
win_mouse_click ("File_1"
("File_1",
, 29,
29, 30);
30);
# Save As_1
set_window ("Save
("Save As_1",
As_1", 3);
obj_mouse_click ("MSO
("MSO Generic Control Container_1",
Container_1", 18,
18, 211,
211, LEFT);
list_activate_item ("SysListView32"
("SysListView32",
, "Local Disk (D:)");
(D:)"); # Item Number
1;
obj_mouse_dbl_click ("RichEdit20W"
("RichEdit20W",
, 32,
32, 2, LEFT);
obj_mouse_click ("RichEdit20W"
("RichEdit20W",
, 32,
32, 2, LEFT);
obj_type ("RichEdit20W"
("RichEdit20W",
,"bRAEWAYKRA<kAlt_L-S>");
"bRAEWAYKRA<kAlt_L-S>");
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Test Results:
1. Winrunner writes the code for you.
2. A sample code written(by the Test Automation Tool) is written below:
set_window (""
("",
, 3);
button_press ("Start"
("Start");
);
# BaseBar
set_window ("BaseBar"
("BaseBar",
, 15);
15);
toolbar_select_item ("ToolbarWindow32"
("ToolbarWindow32",
, "Microsoft Office;Microsoft
Office Word 2003");
2003");
Now What?
Run the Script.
Observe the results, wow it works.
Is that really so simple?
Unfortunately it is not? Read on to know why.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Attention to Detail: go to the folder where Winrunner has recorded and saved the results.
Observe the directory structure.
Pitfalls: Take the script to another machine and run, will this work. Unfortunately
no. But Why?
The test tool is not installed on the target machine. What do you do, buy another license and
install. Now run the script. Will this work? Well it depends (on various dependencies).
Processor Configuration (this one might vary and might not be true for all the test automation
tools out there.
Software configuration needs to exactly match with the machine on which the automation
script was generated (this includes right from the OS version to where the test program has
been generated to where the targeted Test program (that needs to be tested) has been
installed. But why?
Importance of Checks:
Technical Jargon associated with Test Developers and Tool Vendors as well as the Users
and/or Test Engineers like us.
· The most popular Test Automation Tools available work on the principle of
checks.
· While you keep clicking buttons for the test steps.
· What the test tool does is captures all the events and saves them as checks.
· There are some standard checks that most of the Automation Tools use are :
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
1. BMP Checks
2. UI/ Checks
3. Text Checks
4. Co-ordinate Checks
· and so on….
· Please refer to the screen capture as displayed in figure : TSL Online Help File for Checks:
So as you keep hitting the Test Steps, the associated Test Automation Tool keeps recording
the steps as checks and writes the code for the test steps.
TSL is the Scripting language associated with the Test Tool being evaluated.
A couple of Proofs:
Allows you to select another application's objects that you want available in your code by
setting a Reference to that application's Obj Library.
1. After you set a Reference to an object library by selecting the check box next to its
name, you can find a specific object and its methods and properties in the Object
Browser.
2. If you are not using any objects in a referenced library, you should clear the check box
for that Reference to minimize the number of object references Visual Basic must
resolve, thus reducing the time it takes your project to compile. You can't remove a
Reference for an item that is used in your project.
3. If you remove a Reference to an object that your are currently using in your project,
you will receive an error the next time you refer to that object.
Note You can't remove the "Visual Basic For Applications" and "Visual
Basic objects and procedures" references, because they are necessary
for running Visual Basic.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Priority Buttons
Moves references up and down,on the list. When you refer to an object in code, Visual Basic
searches each referenced library selected in the References dialog box in the order the
libraries are displayed. If two referenced libraries contain objects with the same name, Visual
Basic uses the definition provided by the library listed higher in the Available References box.
Result: Displays the name and path of the Reference selected in the Available References
box, as well as the language version.
Browse: Displays the Add Reference dialog box so that you can search other directories for
and add references to the Available Resources box for the following types:
1. Setting References to Type Libs lets say for example *.olb, *.tlb
2. Exe Files – For Example *.exe, *.dll
The Add References dialog box is the Open common dialog box
So based on the checks it keeps writing scripts in the background and it is the inherent
support that Microsoft Windows supports to make it work.
What happens even if there is just 1 pixel mismatch in the target matching
What happens if the Operating System is installed on C drive and is xyz drive.
What happens if the software under test does not have icon under the Program Files Folder.
· Note: Unfortunately in all the above cases, the test script would fail.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Test Plan:
Test Case 1: Invoke the Calculator App via Start-->All Programs-->Accessories-->Calculator.
Expected behavior: The app should get invoked.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Stop Recording
Run the test using the Winrunner Record button.
Observe the results.
Result: It works.
Problem 1: Keep the Calc Application Open, and Run the test.
Test Results: it will display the following error
The Problem: its not been able to recognize the object. Please refer to the screen capture.
Workaround: As the conventional Test tools are based on Object and checks based
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
concepts, we need to ensure that we bring in the kind of generic-ness that is required to
ensure that it runs successfully in 1 go, no matter what.
Even if one instance of any app is open which was not there when the Test was recorded, it
will fail.
If the machine has different OS/Display settings and so on, it will still fail.
There are tonnes of other similar issues, and the list is endless.
Permanent Solution: Winrunner has got its own scripting language associated with it. Which
is pretty intuitive and backed up with good amount of support from the vendor
It has all the debugger support available, and it is very intuitive and user friendly. A screen
cap is attached below. It has highlighted the debugger controls.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Winrunner also uses the Objects concepts withing itself. Please refer to the screen capture
pasted below.
• EVALUATING LOADRUNNER
While working on this book, I was involved in evaluating so many Test Tools, testing as well
as automating. There were a lot of very interesting findings which I have shared in this book
at various places.
One of the most interesting finding was when I found that the most popular test automation
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
tool with maximum no of bugs. In the installation wizard. So can we bank on this. I do not
intend to criticize any Organization/ Tool, so have not specifically mentioned the bugs but just
pasted the screen captures for a handy Reference.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
There really are more than 25 bugs in in its installer itself. Please refer to the Screen captures
I have included in the current section.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Another Classic Example from Microsoft itself: I was trying to reproduce a crash and trying to
use Dr Watson to trace the dump. And came across this dialog box. I must have seen this 100
times, but still wondering as to what it means.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
To show the Quick Macros window, click icon in the system tray or in the Start menu.
Window parts:
Left side - list of QM items - macros, functions, menus, toolbars, TS menus.
Right side - text (list of commands) of the currently selected item.
Bottom-right - QM output or tips. In the output are displayed error descriptions and other
messages.
Bottom - status bar.
Top - menu, toolbar, floating toolbar.
Creating new macro, menu or toolbar
You create a macro for each task you want to automate. To create new macro, click the New
Macro button on the toolbar, and type a name in the small field that appears at the top of the
list. To create an item of other type (function, toolbar, etc), use the popup menu that appears
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
when you click the small arrow beside the New Macro button.
FAQ's on QuickMacros
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Or, you can place special code in the macro or function. Example:
rep
ifk(F12) ret ;;exit if F12 is pressed
...
How to assign a toolbar to a window
Assign it a window trigger. To assign a window trigger, select Window in the Properties
dialog, drag the "Drag" picture and drop onto the window. You may have to edit or remove
window name, e.g., remove the name of the currently open document.
How to create an "auto-hide" toolbar
Click menu File -> New -> Templates -> Toolbar Top or Bottom, or Toolbar Left or Right. To
launch it, you for example can assign a mouse trigger. Or, launch it at startup.
Managing toolbars
You can drag toolbars with the right mouse button. To drag or delete buttons, Shift+Drag.
You can drag macros, files and Internet links and drop onto a toolbar. To change toolbar
style, or quickly open to edit, use the right-click menu.
If you have lost a toolbar (it is running but invisible), use the Toolbars dialog (menu Tools ->
Toolbars).
How to create text-replacement ("autotext") macros
In QM, instead of creating separate macro for each replacement, you create one or several
T.S. menus, and place the replacements there.
Can macros run in any program?
Macros can run in any Windows program. You can make a macro to run only in a certain
program(s).
Some triggers may not work in DOS and console programs, especially in full screen mode and
on Windows 98/Me/Vista. Try low level hooks (in Options). Also, macros may not run properly
in some games.
Can two macros run simultaneously?
Several macros cannot run simultaneously. If a macro (macro2) is launched while a macro is
already running, macro2 will not run. Similarly, several instances of the same macro cannot
run simultaneously.
Several functions can run simultaneously. If a function is launched while a macro or function
is already running, they will run simultaneously.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
text). To disable/enable several lines, select them and right click the selection bar. To add
comments at the end of line, use two semicolons.
Example: comments
key Cv ;;press Ctrl+V
Using strings; inserting newlines and quotes
Strings (text) must be enclosed in double quotes. To insert a double quote in a string, use ''
(two apostrophes). To insert a newline, use [].
All this is true when you enter strings directly. When you enter strings through dialogs
(except the Keys dialog), all this is done automatically.
Example:
out "This is[]multiline string[]with ''double quotes''"
Repeating
Assume you want to repeatedly execute two commands:
lef 100 200
key Y
Insert rep before. Then select the commands and press Tab key. This tab-indents the selected
lines:
rep
lef 100 200
key Y
Repeat 10 times:
rep 10
lef 100 200
key Y
Programming in QM
Using variables
You can use variables almost everywhere in code. To store numeric integer values, use
variables of type int. To store floating-point values - double. To store text - str. Example:
without variables
lef 100 200 "Notepad"
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
use variables
str s="Notepad" ;;declare str variable s, and store "Notepad"
int x y ;;declare int variables x and y
x=100
y=x*2
lef x y s
To share a variable between macros, declare it with +:
int+ global_var
You can use variables in dialogs (floating toolbar). To use a variable in a text field, enclose it
in parentheses. Parentheses are not used in fields that accept numeric values.
Creating and understanding macros is easier if you know the following 20 commands. Some
of them can be entered using dialogs, or recorded, but often it is quicker to write them
directly.
lef, rig Click mouse left or right button. The easiest way to enter these commands is
recording. Or, use the Mouse dialog. Examples:
lef 100 200 ;;left click at 100x200 pixels
lef 90 40 "Notepad" ;;left click at 90x40 pixels in Notepad window
key Press keyboard keys. Type text. To type text, enclose the text into quotes. To enter other
keys, you can record, or use the Keys dialog. Examples:
key "Indya" ;;type text
'"Indya" ;;type text (key can be replaced to ' )
key F12 ;;press F12
key LLLL ;;press Left Arrow four times
key Cv ;;press Ctrl+V
key A{ep} ;;press Alt+E+P
outp Paste text. This command also can be entered through the Text dialog. Examples:
outp "New Zealand" ;;paste text
"New Zealand" ;;paste text (outp can be omitted)
outp s ;;paste variable s
out Display something (numbers, strings, variables, etc) in the QM output. Useful when
debugging macros or learning (experimenting with) various commands and functions. This
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
run Run file, open document, web page, etc. This command also can be entered through the
Run File dialog or other dialogs from the same menu. Or, you can drag and drop a file from
the desktop or Windows Explorer. Examples:
run "C:\WINDOWS\system32\notepad.exe"
run "http://www.quickmacros.com"
act Activate window. This command also can be entered through the Window dialog.
Example:
act "Notepad"
win Find window and return window handle that can be used in other commands. This
command also can be entered through the Find Window Or Control dialog. Example:
int hwnd=win("Internet Explorer" "IEFrame")
act hwnd
wait Insert simple delay, or wait for some event (e.g., window). This command also can be
entered through the Wait dialog. Examples:
wait 5 ;;wait 5 seconds
0.5 ;;wait 0.5 second (wait can be omitted)
wait 30 "Internet Explorer" ;;wait max 30 s for Internet Explorer
mac Launch a macro. This command usually is used in menus and toolbars. To enter it
quickly, drag and drop the macro from the list. Example:
mac "Macro9"
Note: mac is not used to call functions. The launched macro is independent from the current
macro, and the current macro does not wait for it.
err Continue macro if an error occurs. Example:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
wait 2 "Window" ;;wait for Window max 2 s, and then throw error
err ;;on error continue
ret Exit (end current macro or function). Example:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
It would have been redundant to mention everywhere that 1st and foremost
requirement of Test Automation is what you as a tester is supposed to
Automate. Exact Test Steps (Test Plans) and associated results. This is
irrespective of all the Automation Tools and all the scripting lanaguages /
technologies used in the book for demonstration
Test Case/Test Steps:
1. Invoke the Test Tool (QuickMacros in our case).
2. Click the Record button.
3. The Quickmacros will get minimized.
4. Invoke a calculator application.
5. Type 12345679*8 and click the return key.
6. Observe and Record the Test Results.
7. Exit the Calc Application
Test Results:
Displays 87654321
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
1. Run the script then and there on exactly the same environment and observe
the results.
2. It really works.
Validate The Automated Test to Another machine with exactly the same hardware as well as
the the same OS flavor.
Test Results:
It will fail.
Analysis would reveal that the application has not failed, but its the in-efficiency of the tool in
our case.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Inorder to do the automation of the test Plan, perform the following steps:
1. Invoke the Test Tool.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
7. Invoke Microsoft Word, type something, save the document and then close it.
8. On the minimized Test Tool icon, click Insert.
9. It will write the code for the manual test we did.
What happens:
1. Record the Test Results
2. Save the Test Results
Try Analyzing:
Go via code, check out the error msg displayed
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
It did work for calc in the 1st go, but didn't work for Microsoft Word in the vary first attempt.
Why?
The Answer is Complexity handling by the automation tool as the said tool is not that
matured as other 2 that we have used, and that is the reason the 2nd Test of Microsoft Office
Application will work in vary first attempt. So the price is justified and the industry has been
paying it.
What does it take you to do it in case you do not have the test automation tool available with
you. I had tried the same.
Conclusions and Interesting Findings: I tried to do it using Active Perl and the result were
really interesting:
1. I could automate in lesser amount of time.
2. It worked across on all windows platforms.
3. Saving a cost of one of the most expensive tools in the world. Active Perl is free.
4. 4 Preventing licensing costs and also saving a huge amount of resources that the
automation tool demands.
One of the myth that i have seen is people generally treat automation tools and jargon fancy,
is this they have to spend money or is it ignorance. Whatever, but does not deserve to be
spared.
I have listed a couple of functionalities of the current test tool, and could not find anything
that cannot be done in lets say Microsoft's inherent scripting language.
What is a macro
How Quick Macros work
Quick Macros window
Creating new macro, menu or toolbar
Adding macro commands
Recording
Adding menu items and toolbar buttons
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
My Findings: as far as Macros go, the Microsoft provides the support anyway. Although a little
more effort is required. Please refer to the screen capture
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
As a layman/tester, you just see the UI. But what happens in the background is something
that always remains hidden for a Tester. I have tried to throw some light on that. Lets start
from the vary first home screen/window.
In the Quick Macros window, you can create macros, as well as items of other types
(functions, toolbars, etc). You create a macro for each task you want to automate. You can
assign it a trigger (e.g., hot key), or place it in a toolbar or menu.
Quick Macros runs continuously (although normally it is hidden most of the time). It watches
for triggers that are assigned to macros. When a trigger occurs (e.g., hot key pressed), is
launched the macro to which the trigger is assigned. When the macro runs, are executed
commands it contains. Quick Macros also manages your toolbars and menus.
Quick Macros window
To show the Quick Macros window, click icon in the system tray or in the Start menu window
parts:
Left side - list of QM items - macros, functions, menus, toolbars, TS menus.
Right side - text (list of commands) of the currently selected item.
Bottom-right - QM output or tips. In the output are displayed error descriptions and other
messages.
Bottom - status bar.
Top - menu, toolbar, floating toolbar.
Creating new macro, menu or toolbar
You create a macro for each task you want to automate. To create new macro, click the New
Macro button on the toolbar, and type a name in the small field that appears at the top of the
list. To create an item of other type (function, toolbar, etc), use the popup menu that appears
when you click the small arrow beside the New Macro button.
Adding macro commands
Macros are stored as simple text. Usually, each command is stored in a separate line.
To add macro commands, you can use dialogs from the floating toolbar. However, QM does
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
not provide dialogs for all commands, and therefore you have to type other commands
directly. You can find all commands listed in the Reference topic. You can also type a period
(.) to view and insert available commands, functions, etc.
The simplest way to add macro commands - record.
Recording
You can record keystrokes, mouse, and some other commands. You can record complete
macro, or only some parts.
To start recording, click the Record button on the toolbar. When recording is finished, click
Insert or other button in the QM Recording dialog.
Recorded macro often is not perfect. You have to review and possibly edit it. For example,
recorded macro may run too fast, and you have to insert delays or change the wait time in
wait commands. Recorded window names often contain document name, which causes error
when running the macro when there is open other document. In this case, remove document
name.
When recording, it is recommended to use the keyboard instead of the mouse (where
possible), especially to select menu items (use Alt and underlined letters). It is because
menus and other objects next time may be in another place, even when recorded mouse
coordinates are relative to window (default).
Adding menu items and toolbar buttons
Menu text is simply a list of macro commands. Each command is preceded by some text
(label), space and colon. The same with toolbars. Each line creates menu item or toolbar
button, which will execute the command.
Lets say for Example:
Macro18 :mac "Macro18"
Notepad :run "notepad.exe"
Email :key "abhinav@indiantestingboard.com" * text.ico
Login :key "abcd"; key T; key "1234"; key Y * text.ico
To quickly add a macro, drag and drop it from the list to the menu/toolbar text. To add a file,
use the Run File dialog from the floating toolbar, or drag the file from the desktop or Windows
Explorer. To add other commands, use other dialogs from the floating toolbar. To add a
separator, type - or |. To add icons, use the Icons dialog.
Launching macros, menus and toolbars
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
If it is a function, you cannot end it with Pause. Right click the QM tray icon, click End
Function, select the function in the Threads dialog, and click End Thread. Or, if you use the
AddTrayIcon function to add a separate icon, you can Ctrl+click it.
Or, you can place special code in the macro or function. Lets say for Example:
rep
ifk(F12) ret ;;exit if F12 is pressed
...
How to assign a toolbar to a window
Assign it a window trigger. To assign a window trigger, select Window in the Properties
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
dialog, drag the "Drag" picture and drop onto the window. You may have to edit or
remove window name, e.g., remove the name of the currently open document.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Strings (text) must be enclosed in double quotes. To insert a double quote in a string, use ''
(two apostrophes). To insert a newline, use [].
All this is true when you enter strings directly. When you enter strings through dialogs
(except the Keys dialog), all this is done automatically.
Lets say for Example:
out "This is[]multiline string[]with ''double quotes''"
Repeating
Assume you want to repeatedly execute two commands:
lef 100 200
key Y
Insert rep before. Then select the commands and press Tab key. This tab-indents the selected
lines:
rep
lef 100 200
key Y
Repeat 10 times:
rep 10
lef 100 200
key Y
Using variables
You can use variables almost everywhere in code. To store numeric integer values, use
variables of type int. To store floating-point values - double. To store text - str. Lets say for
Example:
without variables
lef 100 200 "Notepad"
use variables
str s="Notepad" ;;declare str variable s, and store "Notepad"
int x y ;;declare int variables x and y
x=100
y=x*2
lef x y s
To share a variable between macros, declare it with +:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
int+ global_var
You can use variables in dialogs (floating toolbar). To use a variable in a text field, enclose it
in parentheses. Parentheses are not used in fields that accept numeric values.
Top 20 commands
Creating and understanding macros is easier if you know the following 20 commands. Some
of them can be entered using dialogs, or recorded, but often it is quicker to write them
directly.
lef, rig Click mouse left or right button. The easiest way to enter these commands is
recording. Or, use the Mouse dialog. Examples:
lef 100 200 ;;left click at 100x200 pixels
lef 90 40 "Notepad" ;;left click at 90x40 pixels in Notepad window
key Press keyboard keys. Type text. To type text, enclose the text into quotes. To enter other
keys, you can record, or use the Keys dialog. Examples:
key "Indya" ;;type text
'"Indya" ;;type text (key can be replaced to ' )
key F12 ;;press F12
key LLLL ;;press Left Arrow four times
key Cv ;;press Ctrl+V
key A{ep} ;;press Alt+E+P
outp Paste text. This command also can be entered through the Text dialog. Examples:
outp "New Zealand" ;;paste text
"New Zealand" ;;paste text (outp can be omitted)
outp s ;;paste variable s
out Display something (numbers, strings, variables, etc) in the QM output. Useful when
debugging macros or learning (experimenting with) various commands and functions. This
command also can be entered through the Text dialog. Examples:
out "I am here" ;;display text
out i ;;display variable i
mes Display something in a message box. This command also can be entered through the
Message Box dialog. Examples:
mes "Important information"
if(mes("Continue?" "" "YN")='N') ;;if the user clicks No
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
ret ;;exit
run Run file, open document, web page, etc. This command also can be entered through the
Run File dialog or other dialogs from the same menu. Or, you can drag and drop a file from
the desktop or Windows Explorer. Examples:
run "C:\WINDOWS\system32\notepad.exe"
run "http://www.quickmacros.com"
act Activate window. This command also can be entered through the Window dialog. Lets say
for Example:
act "Notepad"
win Find window and return window handle that can be used in other commands. This
command also can be entered through the Find Window Or Control dialog. Lets say for
Example:
int hwnd=win("Internet Explorer" "IEFrame")
act hwnd
wait Insert simple delay, or wait for some event (e.g., window). This command also can be
entered through the Wait dialog. Examples:
wait 5 ;;wait 5 seconds
0.5 ;;wait 0.5 second (wait can be omitted)
wait 30 "Internet Explorer" ;;wait max 30 s for Internet Explorer
mac Launch a macro. This command usually is used in menus and toolbars. To enter it
quickly, drag and drop the macro from the list. Lets say for Example:
mac "Macro9"
Note: mac is not used to call functions. The launched macro is independent from the current
macro, and the current macro does not wait for it.
err Continue macro if an error occurs. Lets say for Example:
wait 2 "Window" ;;wait for Window max 2 s, and then throw error
err ;;on error continue
ret Exit (end current macro or function). Lets say for Example:
if(i=0) ret ;;if variable i is 0, exit
goto Go to another line. Lets say for Example:
if(i>=10) goto g1 ;;if variable i is >= 10, go to the g1 label
out "This line is executed only if i is < 10"
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
g1
out "This line is executed always"
if, else Execute or skip commands if certain condition is true. The commands must be
preceded by a tab, unless they are in the same line. Lets say for Example:
if i<5 ;;if variable i is less than 5, execute the following two commands
out "variable i is < 5"
i+1
else ;;else execute the following one command
out "variable i is >= 5"
rep, break Repeatedly execute commands. The commands must be preceded by a tab, unless
they are in the same line. Examples:
rep 10 ;;press Right Arrow 10 times
key R
Repeat while variable i is <= 5:
int i ;;declare variable i
rep
i+1
if i>5
out "i is > 5"
break ;;exit the loop
out i
int, str Declare variables. Use int for numeric integer variables. Use str for string variables.
Examples:
str s="Notepad" ;;declare str variable s, and store "Notepad"
int x y ;;declare int variables x and y
int+ g_var ;;declare global int variable g_var
A lot of critics say negative things about all the test automation tools available, but there are
a lot of handy stuff out there. Please refer to the Screen capture as displayed in Figure 19.
There are a lot of good and handy things about QuickMacros which I personally found
impressive with the cost that is associated with the Product.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
QA Run is another tool owned by Compuware Corporation, which I have used extensively
during my Motorola days. It also works on the same principle of record/capture, compile and
run. Takes everything as checks, text checks, bmp checks and so on. One of the finest
encounters that I faced with the tool is really interesting. I was handed over the task of
automation a smoke test for an IDE, and the time allocated was 1 week. I clicked the
record/capture button and kept on executing the tests. The test used to take around 5~6
hours to accomplish. After I finished, compiled and ran the script. To my surprise it worked.
Although the tool was pretty expensive, but my experience was a breeze. But there was
something in the back of my mind that it cannot be so simple. Then I took the code to
another machine and tried to run, it failed. And then it took me the entire week to complete
the smoke automation and that too putting in 12 hours a day. It did work at the end of the
work, but it took a lot of effort in order to bring genericness to the automation code. At the
end of the day, the complexities remain the same.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Doing a fair amount of home work is a key to any success, and the same happens to be true
in our case also. But its a whole world out there. I have tried to tailor what is required strictly
from a Testers perspective.
3. Windows Kernel
4. Windows API’s
6. OLE
8. Scripting Architectures
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Before We go to the Insights of Microsoft Windows Operating System, here is the Figure of
the same (highest level abstract for a higher level underlying grey matter which matters the
most.
Scripting
Language
Application
Programming
Interface (API)
Hardware
x86 In Our
Case
Figure: Highest Level Architectural View of Microsoft Windows-- Block Diagram Illustration
Lets talk about Internals and associated Representation in block diagram: Please refer to the
Figure.
It talks about the hardware Architecture (X86) in our case. The basic memory management
and associated processes/components.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Please refer to the block text and diagram view below. I think you should be able to map this
to the above mentioned Architectures (Off course at an abstract level).
API
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Drivers\Windows Kernel
Hardware
Bridgeing The Logical Divide: Test Automation Checks & mapping/interpretation to the
Conventional Microsoft Windows insights.
The Figure shows a mapping of Checks in Test Automation Tools are a notation/jargon for
Objects in Operating Systems (Little variations here and there; just for implementation, and
nothing else)
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Too Confused? Don't worry guys. There is one of my all time favorite Quote from one of the
smartest guys in Windows.
Learning Windows API's gives you vital insights into working of Microsoft Windows
that are regardless of what you end up using to actually do the coding.
Windows is a complex system, putting a programming layer on top of API which
does not eliminate the complexity. It merely hides it, sooner or later that
complexity is going to jump out and bite in the leg. Programming Windows 5th
edition, by Charles Petzoid.
On the Microsoft Operating Systems, I have not come across many testers who know the core
of boot loaders of Windows. I have tried to tailor down just for the testing perspective.
Sounds Geek, don't worry guys. There is always a 1st time.
I have pasted below a typical Boot Loader File from my Windows XP machine. Looks
explanatory. It becomes all the more important when you need to have multiple OS'es flavors
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
on the same vendor. Or even when you want to have a dual-boot with Linux flavor, wherein
Linux itself has 2 popular boot loaders: Lilo, and Grub.
[boot loader]
timeout=0
default=multi(0)disk(0) rdisk(0)partition(1)\WINDOWS
rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /
noexecute=
noexecute=option /fastdetect
/fastdetect
Explanation: fixmbr \Device\HardDisk0The device (drive) on which you intend to have the
Boot Record.
The name can be obtained from the output of the map command. An example of a
device name is:
It is not recommended to play with Master Boot Records unless in-editable due
to multiple reasons. But understanding definitely is required by the testers time
to time.
What are ini's? The “.ini” files come with .ini as an extension. Contains the hardware specific
information.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Firmware Interface (EFI) between the computer's firmware, hardware, and the operating
system. EFI includes a new disk partitioning style, the GUID partition table (GPT).
Compared to the disk partitioning style, which supports volumes up to 2 terabytes in size and
up to 4 primary partitions per disk (or three primary partitions, one extended partition, and
unlimited logical drives), GPT supports volumes up to 18 gigabytes in size and up to 128
partitions per disk. Unlike partitioned disks, data critical to platform operation is located in
partitions instead of unpartitioned or hidden sectors. In addition, GPT partitioned disks have
redundant primary and backup partition tables for improved partition data structure integrity.
Disk Management describes disks with the GUID partition table (GPT) partitioning style as
GPT disks and disks with the master boot record partitioning style as disks. You can perform
the same tasks on GPT disks as you can on disks with the following exceptions:
• GPT disks are supported only by Windows XP 64-Bit Edition. You cannot move GPT
disks to computers running the 32-bit versions of Windows XP. From Disk Management
on computers running a 32-bit version of Windows XP, GPT disks appear as basic
disks with a single partition covering the whole disk, but the data on the partition
cannot be accessed.
• The operating system loader and boot partition must reside on a GPT disk. Other hard
mix of basic GPT and disks, which are not part of disk groups.
• You can convert an disk to a GPT disk and vice versa only if the disk is empty.
• You cannot use the GPT partitioning style on removable media, detachable disks that
use universal serial bus (USB) or IEEE 1394 (also called FireWire) interfaces, or on
cluster disks that are connected to shared SCSI or Fiber Channel buses used by the
Cluster service.
You can create partitions on basic GPT disks using the EFI firmware utility diskpart.efi, the
diskpart.exe command-line utility, or Disk Management in Windows XP 64-Bit Edition
What is a Process: The Process corresponds to the resources being used by CPU. Can be
said to be an instance of a running program. The processes are created to run a
program/application.
Then, the app generates Process as defined by Address space
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
What is a Thread? An execution ext within a process Unit of scheduling (threads run,
processes don’t run) All threads in a process share the same pre-process address spacing.
Also, the services provided so that threads can synchronize access to shared resources
(critical sections, mutexes, events, semaphores.. and so on). Primarily, all threading in
Operating Systems is referred to as peers to all others. And this happens to be irrespective of
other processes: let it be parent, address spacing and so on.
System-wide, Address Space, Thread. I tried it and it was a breeze.
In order to do this:
Go to Start-Run.
Type: tasklist /svc tasklist /svctasklist /svctasklist /svc
# Abhinav Vaid
# In All Things be Men
# Building Automated Test Systems- Windows
C:\Documents and Settings\naudee
Settings\naudee>
>cd\
cd\
C:\>svchost
C:\>svchost
C:\>tasklist /svc
Image Name PID Services
========================= ======
=============================================
System Idle Process 0 N/A
System 4 N/A
smss.exe 432 N/A
csrss.exe 488 N/A
winlogon.exe 512 N/A
services.exe 556 Eventlog,
Eventlog, PlugPlay
lsass.exe 568 PolicyAgent,
PolicyAgent, ProtectedStorage,
ProtectedStorage, SamSs
svchost.exe 716 DcomLaunch,
DcomLaunch, TermService
svchost.exe 816 RpcSs
svchost.exe 888 6to4, AudioSrv,
AudioSrv, Browser, CryptSvc, Dhcp,
Dhcp,
dmserver, ERSvc, EventSystem,
EventSystem,
FastUserSwitchingCompatibility, helpsvc,
helpsvc,
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
lanmanserver,
lanmanserver, lanmanworkstation, Netman,
Netman,
Nla, NwSapAgent, RasMan, Schedule, seclogon,
SENS, SharedAccess,
SharedAccess, ShellHWDetection,
srservice, TapiSrv, TrkWks, W32Time,
winmgmt, wscsvc, wuauserv, WZCSVC
svchost.exe 932 Dnscache
svchost.exe 1016 LmHosts, RemoteRegistry, SSDPSRV, WebClient
spoolsv.exe 1108 Spooler
svchost.exe 1204 BthServ
btwdins.exe 1224 btwdins
Apache.exe 1240 dev4_423
Mcdetect.exe 1292 McDetect.exe
McShield.exe 1312 McShield
McTskshd.exe 1364 McTskshd.exe
PAStiSvc.exe 1556 STI Simulator
svchost.exe 1568 stisvc
Apache.exe 1632 N/A
alg.exe 232 ALG
explorer.exe 880 N/A
mcagent.exe 2280 N/A
Residence.exe 2344 N/A
GoogleWebAccWarden.exe 2356 N/A
GoogleWebAccClient.exe 2416 N/A
mcvsshld.exe 2140 N/A
McVSEscn.exe 2612 N/A
IEXPLORE.EXE 2036 N/A
BBImpSec.exe 3356 N/A
AcroRd32.exe 3496 N/A
WINWORD.EXE 2060 N/A
cmd.exe 1984 N/A
tasklist.exe 4044 N/A
wmiprvse.exe 2264 N/A
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
C:\>
Developers Need proofs: If thread stack doesn’t solve it, get a memory
dump of the process address space & attach to the bug tracking system along with the bug
details, Period. No Re-produceability debates. But guys, its easier said than done.
Drwtsn32.exe Drwtsn32.exe -p <processid> Creates User.dmp file
Run Drwtsn32.exe with no switches to see crash dump Path Note: in XP and later, by default
does not create a full dump. But it needs to be configured. In order to do this, perform the
following steps:
1. Go to System-Properties-Advanced Tab
2. Under Startup and Recovery, click the Settings button.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Windows Crashes, the same old debates. There was developer's conference organized by
Microsoft guys and the statistical data was generated from the inputs that were derived.
Precisely, this is what it is:
~70% caused by 3rd party driver code
~15% caused by unknown (memory is too corrupted to tell)
~10% caused by hardware issues
~5% caused by Microsoft code
Microsoft Windows Kernel writes memory but not the processes. In most of the cases
(definitely not always) most crashes related debugging doesn’t involve looking at process
memory anyway Useful for large memory systems.
Remember, whenever there is any exception raised, the options thrown are abort/debug, on
selecting the later, the applications gets attached to the debugger.
If you want to go deeper to understand: The latest Microsoft OS'es XP, Vista the minidump is
always created, even if system set to full or kernel dump Can extract a minidump from a
kernel or full dump using the debugger “.dump /m” command. To analyze, requires access to
the images on the system that crashed At least must have have access to the Ntoskrnl.exe
Microsoft Symbol Server now has images for Windows XP and later Set image path to same
as symbol path (covered later) Writing a Crash Dump Crash dumps are written to the paging
file Too risky to try and create a new file (no guarantee you will get a dump anyway) How is
even this protected? When the system boots it checks HKEY_LOCAL_MACHINE\System\
CurrentrolSet\rol\Crashrol.The boot disk paging file’s on-disk mapping is obtained Relevant
components are checksummed: Boot disk miniport driver Crash I/O functions Page file map
On crash, if checksum doesn’t match, dump is not written At The Reboot
Confusing Jargon: guys, please do not confuse the image name mentioned to the System
Images that we have been using for retrieval from crashes. I am attaching a screen cap to
clarify.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
1. Win32 API is the interface provided by Microsoft guys along with the Operating Systems.
2. API is used/referred to build applications on top of the OS, whether it is an application
program/or a script to Test/Automate.
3. Intention is to give support for accessing and building components.
There is a very old quote from one of the most widely accepted OS guru, and it
happens to be one of my favorite one. It says Windows is a n extremely
complicated and bulky system, with a programming layer on top of it (known
as API) which merely hides it, and one day which will definitely come out and
bite right on your leg.
Now comes the identifications and usages associated.
I have give a couple of examples, try them along with the help files of the OS.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Do a
$gettemppath = new win32:: API'kernel32', 'kernel32.dll',)
3rd parameter listing consists of i/p parameter list; no of arguments required and the function
and their types can also be passed as a string, can be identified as a parameter/list
references;
and the 4th parameter returns the value returned by the function.
$gettemppath = new win32:: API'kernel32', 'gettemppath','NP',N);
For example;
In win 9x, systems, we can use Quickview to know the functions that it exposes.
There is a limitation however,
The 16 bit dlls have limitations however win32 based dlls can be used more than once.
Microsoft did manage to change the entire landscape of technologies associated with
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Computing. And it did manage to significantly penetrate the market. It had a very clear focus
in place, usability and wizards driven technologies associated.
How ever there was 1 thing lagging, it was support for building applications over the OS. With
everything hidden inside(unlike Linux), and OS not stable enough to work things out. But yes
things have been changing positively. There was a time when you talked about windows
kernel, people used to panic. So how does the change help us.
The Component Object Model (COM) is a scripting language-independent and object-oriented
programming model which defines the standards for implementation. It is definitely not a
programming language. It is a binary standard that enables software to be implemented as
units called components. The component can be edited in any programming/scripting
language or scripting language associated with the same. After the binary unit has been built,
it can communicate with other units that were produced in any other scripting language, on
the same machine or on remote machines provided that the units were written as COM
components.
COM forms the core of all Microsoft technologies, and provides the skeleton for all it's future
strategies. OLE is placed higher than COM and ActiveX sits on top of OLE. Most of the
engineers associated with the Internet based development, ActiveX is a series of OLE classes.
If you consider a Microsoft product like Visual Basic, you will find the concept of components.
These components may have properties and events and other attributes. These components
can be inserted into any container like VB, PB and so on etc. and later can be integrated into.
For VB, that sounds fine, but the irony of the situation is that if we wanted to do the same
thing from C++, then we will have a problem. It was extremely difficult to use ActiveX from
C++, even though the entire ActiveX, OLE, COM families are based on C++. This was till the
time Microsoft introduced Visual C++ 5.0
But its not as complicated as it might sound to you at this point of time, all the Microsoft
Office Applications have been supporting them. And only thing is you might not have used it
yourself. But its there. Please refer to the screen capture
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
In summary, although the scripting language in which a component is generated may vary
from component to component, a binary standard overcomes the limitation of programming
in different languages. It does not care about anything else but the binary form of the
targeted processor's code that the once source code was turned into and the fact that is
implemented into COM. In this sense, the component is not a regular script or executable, but
a black box that performs one task and returns the projected result.
Multiple languages can be used for one application because COM provides a binary standard.
A binary standard also results in platform-independence provided that multiple platforms
support COM. Units of code that are used in COM are known as components, and on Windows
a component is normally file with the extension .dll; however, there are offshoots such as
Windows Script Components, which have the extension .wsc. The purpose of the component
is to perform the one task that it has been programmed for, and through COM, it can
communicate with other components, languages, and platforms.
COM is just a set of standards laid down to compily/adhere to. It can also be termed as a a
specifications laid down for Impmentation. And being both a specification and an
implementation, the COM defines a standard for how the components are created and how
they communicate - namely as objects. As a result, the specification solves the
implementation issues of the following key issues:
Although the parts above are involved in the specification of how to implement components,
the automation engineer normally does not have to worry much about them. A software
development tool that holds high class will create a skeleton for a component, and leave it up
to the automation engineer only to plug in the code in the right places. Thanks to this, the
code itself can be developed, debugged, and experimented with as usual. And then when the
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
code is finished, it is placed in the skeleton, the right buttons are clicked, and the component
pops out.
Interfaces can very much be changed refer to prog id,s n registry, you will find no of entries
for same @ sme will have version no associated. But all theclsid's will be same
COM Class: Next, the COM class implements, or maybe better 'inherits', one or more COM
interfaces.
What is a Class ID (CLSID) globally uniquely identifies the COM class, and while the interfaces
are at the base level of the COM architecture, the COM class is on top of the interfaces - one
step close to the application. In other words a Class ID is a globally unique identifier, which is
used to identify control(something that is required to become comfortable to locate a specific
control on your machine. The main purpose of the COM class is to generate, or initiate, the
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Each window has got a control id associated. They further have the child windows.
Such child windows have windows control, hitch uniquely identifies it
irrespective of the machine thus taking care of genericness across any machine
irrespective of fighting out for (checks); Remember I talked about, Grab the
core/pulse and the rest will follow.
COM Object: As previously mentioned, this part of COM simply is the instance of a COM class,
or the entity from which all the features of the COM class are accessed.
COM Component: In the midst of everything, where does the component fit into the picture?
It can be easily summarized as that the component is used to include a COM class by
identifying it by the CLSID, create an instance of the COM class as the COM object, and then
let the application make use if the COM object on the machine.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Scripting and Software Test Automation: Theories and Concepts-Technical Jargon Associated:
What is Scripting: The concept of Scripting had started to Automate small and monotonous
tasks, using/writing small scripts/programs to make them work. Let it be doing automating
IT/admin tasks to building macros for MS Office Applications.
There was always a question raised, Why Scripting and why not Programming.
The answer is simplicity and genericness that most of the scripting engines provide rather
than full-fledged programming languages. Also, scripts are easy to write and maintain. But
no, scripts are definitely easy to write, but writing intelligent scripts is the real challenge.
Especially when you are automating the Software Tests where the real challenge is to
automate the whole test suite. And the tester should ideally be able to run lets say at the
EOD, and the next morning, he has the results. This is the real challenge, for the scriptwriter
to make it generic enough and handle errors (if any), that can make the test execution to
stop in case of any error. Have U heard of “Onerror resume next”. We will cover this later in
the book.
What is Black Box Programming: this is the most convenient way of using procedures to
achieve modularity.
What is Modularity: The process of organizing the code to modules, with an intention to
make the code organized.
What is a What is a Procedure: Procedure is more of a general term that could mean a:
What is a QA and /or QC (Software Testing) and the thin like in between: There
cannot be any other term to start with especially with respect to our subject. Hundreds and
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
What is a Debugger: Used mostly to debug software programs intended to make them bug
free.
What is a IDE: Integrated Development environment, usually a GUI based interface.
Run-time: This is mostly applicable for scripting languages, where the code runs line by line
and gets executed simultaneously.
What is a Binaries/byte-code: its mostly associated to the programming languages and
IDE’s(dev environments), consisting of compilers, debuggers, assemblers, linkers and/or a
combination of them to generate byte code/binaries/exe’s/installers which run at a later stage
on deployment. The compile time and runtime are different in ideal conditions, but can be
integrated also for effective optimizations. The same is true for Microsoft Windows.
What is a White Box Testing: Also known as glass box testing is the Unit Level Testing, to
be more specific it’s the code testing. And all the time, it reminds me of a continent about
everyone wants to talk about as much as they possibly can. And when you are told, or try to
go there everyone runs away like a thief saving for his life. Reason is simple, Whitebox
testing is nothing but a glass box testing, where in each and every
function/unit/module/subroutine..... is tested as per the coding guidelines specified. The only
thing that a tester can do here is compliance checks with respect to the coding guidelines
being followed or not. Having audits, incorporating comments and so on. Also this is true
mostly for larger size organizations. For very small startups or thin engineering firms,
multitasking makes more sense where the developers mostly do the development as well as
testing. A detailed and mapping with respect to various demanding engineering needs has
been explained in the end of the book.
What is a Grey Box Testing: Falls between Black and White Box Testing
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
The various Compiler guru's say/claim that a program translated by a compiler is often much
faster than an interpreter executing the same program: even a 10:1 ratio is not uncommon.
The mixed solution's efficiency is typically somewhere in between. The downsides of the
"compiler" solution are the inherent complexity of a good implementation, and longer test run
cycles.
An Interpreter, on the other hand executes during run-time, line by line.
It takes longer to run a program under an interpreter than to run the compiled code but it can
take less time to interpret it than the total time required to compile and run it. This becomes
all the more important when prototyping and testing code when an -interpret-debug cycle can
often be much shorter than an -compile-run-debug cycle.
The various Compiler gurus claim that Interpreting code is slower than running the compiled
code because the interpreter is supposed to analyze each statement in the program each time
it is executed and then perform the desired action whereas the compiled code just performs
the action.
What is ASCII: An ASCII can be defined as a 7bit code, which means that it uses the bit
patterns representable with seven binary digits (a range of 0 to 127 decimal) to represent
character information. At the time ASCII was introduced, many computers dealt with 8bit
groups
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
What is Graphical User Interface (GUI): which is also termed as GUI, sometimes
pronounced "gooey") is a the directly interfacing with the Computer.
Scripting Languages (commonly called scripting programming languages or script languages)
are computer-programming languages initially designed for "scripting" the operations of a
computer.
A couple of such scripting languages happen to be complicated and generally used to write
very lengthy programs, which are often still called scripts even though they go well beyond
automating simple computer tasks. A script scripting language can be found at almost every
level of a computer system. Besides being found at the level of the OS itself they appear in
computer games, web applications, word processing documents, administrative tasks etc.
Scripting is sometimes also used for connecting diverse pre-existing components to
accomplish a new related task.
Many scripting languages emerged as tools for executing one-off tasks. A batch file is typical
example of the same, which is still being used.
Scripts are normally stored only in their plain text form.
Some scripting languages are designed for a specific domain, but often it is possible to write
more general programs in that scripting language.
In very large Test Systems, a scripting language and a lower level programming scripting
language can be used together. Intention is to get the best of each.
On any fresh installation of Windows Operating System, do a find all (Start--> Search) for
any script, let it be batch, java script or vbs. Observe how the MS guys have implemented the
stuff. I am sure you are going to enjoy this. Pasted below is a sample of js taken on Windows
XP. Try it over other versions of windows with variety of languages.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Although, for a developer it is a good idea but for the automation/test engineer/scripter
normally doesn’t have much choice to optimize for speed and/or to conserve memory, and
the main objective always remains to automate the test cycle and ensuring to bring
genericness and effective test system.
For the reasons noted above, it is usually faster to program in a scripting language, and
scripts/programs are relatively smaller lets say, equivalent C program files. The only
downside could be a fractional (or even little more) time consuming, which should not make
much of a big difference as the intent is to run the un-attended test cycles, when a tester can
leave the tests running at the end of the day and when he is back the next day, he/she has
the results in front of him.
Scripting languages are mostly interpreted (not always), can be relatively slower to execute
and can have larger memory overheads. In many cases, however, e.g. with small scripts of
some tens of lines, the write-time advantage far outweighs the run-time disadvantage.
I have been doing this for years now, and the latest fun we've had is leaving the un-
attended tests at the end of the day, and as soon as the tests complete, we get
an sms trigger along with the auto-generated test report. We implemented
almost a month back. And it was a lot of fun. Of course when we are back the
next day, the test results are there as configured.
The thin line between scripting languages and regular programming languages sill looks to be
dithered.
What is Shell Scripting: A major class of scripting languages has grown out of the
automation of job control starting and controlling the behavior of system programs. Many of
these languages' interpreters double as the MS-DOS COMMAND.COM. For Lets say for
Example: batch files still remains to be one of the favorites of our OS Vendors.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
What are Macros: When the industry was maturing and moving also from command line
based systems to GUI based systems. Thus came the need for for controlling the
Controls/Widgets/Menus etc.
The technological jargon named it to Macros. interact with the same graphic windows,
menus, buttons and such that a person does. They are typically used to automate repetitive
actions or configure a standard state. In theory they could be used to control any application
running on a GUI-based computer, but in practice the support for such languages depend on
the application and operating system.
Vendors have even started supplying with the Tools, for example, Microsoft Office provides
inbuilt support for Macros. Which can either be directly recorded or tailored manually using
the code.
Not only Microsoft, but other vendors are also giving support for Macros. Just for the
Reference, please see the interface for using Macros in OpenOffice.
What are Application Specific languages A lot of scripting languages are tailored as per
the needs of the software application and/or end user.
Since I am currently associated to mobile gaming industry, let me take the example of
gaming itself. In order to build games (whether mobile or desktop), the engineer’s normally
use a custom scripting scripting language to express the programmed actions of characters
and the gaming target environment.
Now comes the trick, whether it is a mobile device(ARM architecture based) or a desktop
computer the development machine would remain to be desktop computer. Only difference
would be the usage of cross-compiler targeted for the ARM based architecture.
There was a time when MIPS was the all time favorite environment for game development. In
that case also, the desktop computer used to be used for game development generating
binaries for MIPS based architecture again using cross compiler.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
resulting in the building up of the internal data of the compiler (such as the evolving symbol
table and other assisting data).
The front end translates the source scripting language into an intermediate representation
(not middleware). The second stage is the back end, which works with the internal
representation to produce code in the output scripting language. The front end and back
end may operate as separate passes, or the front end may call the back end as a
subroutine, passing it the intermediate representation.
Often, optimizers and error checkers can be shared by both front ends and back ends if they
are designed to operate on the intermediate scripting language that a front-end passes to a
back end. This can let many compilers (combinations of front and back ends) reuse the large
amounts of work that often go into code analyzers and optimizers.
What are Code Generators - the transformed intermediate scripting language is translated
into the output scripting language. This involves decisions related to resource, variables to fit
into registers, memory and the selection and scheduling of appropriate machine instructions
along with their associated addressing modes(of the target processor).
r hand, there are making it little fancy.
Due to the extra time and space needed for compiler analysis and optimization, most
compilers choose to skip them by default. Users have to use compilation options to explicitly
tell the compiler which optimizations should be enabled.
Scripting languages (commonly called scripting programming languages or script languages)
are programming languages initially designed for "scripting" the operations of a computer.
Early script languages were often called batch languages. We still use batch files.
What are Macros/Macro Based languages: When the industry was moving from command line
UNIX days to GUI based Windows. The computing environment was calling for a requirement
of scripting scripting language for controlling a computer. These languages, usually called
Macro languages, interact with the same graphic windows, menus, buttons and such that a
person does. They are typically used to automate repetitive actions or configure a standard
state. In theory they could be used to control any application running on a GUI-based
computer, but in practice the support for such languages depend on the application
What are Application Specific languages: Many large application programs include an
idiomatic scripting scripting language tailored to the needs of the application user. Likewise,
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
many computer game systems use a custom scripting scripting language to express the
programmed actions of non-player characters and the game environment. A couple of them
are:
What are Scripting Languages? What are the Types of Scripting Languages
How do we associate them to the subject of the book.
Some of the most widely accepted and used scripting languages are:
SNO Scripting Standard Extensions Description
Language
1. batch file .bat operating system batch
2. ASP .asp Active Server Page
3. HTML .html Web page
4. JScript .js Windows script
5. VBScript .vbs Windows script
6. Windows .wsf Project file for a Windows script;
Script Host supported by WSH 2.0 and later
7. Windows .wsh Property file for a script file;
Script Host supported by WSH 1.0 and later.
Each script type is suited to different test environment needs, and each has strengths and
weaknesses. The script type you choose depends on your needs.
Still, there are certain scenarios where you could divide your overall problem into several
smaller parts, writing a separate script for each part with each script written in the most
suitable scripting language.
What is an Editor: Tool to write/manage code. Mostly used in scripting languages and or
interpreters.
What is Byte Code: A typical example is an exe built from the sources, which is later
installed on a target system and then run.
What is Black Box Programming: Not a true command line stuff. More of a code generator
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
giving functionality of drag and drop etc, everything kind of made handy, where the code
required to write is just validations.
What is Grey Box Testing: Thin line between black box and White Box.
What is Windows Scripting Host: This is where Windows Script Host files (WSF files) are
useful. WSF files may include other script files as part of the script. Consequently, multiple
WSF files can Reference libraries of useful functions, which may be created and stored in a
single place.
What is a Class: Is a template from which objects are created/instantiated.
What are Interfaces: are the …., which allow automation, there are various types of
interfaces, with the most common ones are which are described later in the book, along with
examples.
What are Methods:
Analogous to Function/Procedures. It’s the action that the object can perform.
What are Objects: Objects are created during runtime from a “Class” which can be broadly
defined as a template from which objects are created. From our perspective, it is a construct
that contains:
Objects have 3 distinct identifiers i.e., ProgID, ClassID, GUIID, which are used to access
properties and methods.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
on your machine.
Doing homework is the utmost necessity, the more you dig hard the better would be the
result, whether it is a product or test system of the product. Lets do our homework before
going into real techie stuff.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
c) Using Winspy
Another opensource Object capturing tool available
d) Using Windowse
Greatis is the name of the Organization that has built the said tool for Object
Capturing/identification. The Vendor specializes in system software development and
programming software for developers. And has released a couple of freeware/opensource
tools and Windowse is one of them.
How to use?
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
I have been a all time fan of this particular tool for Object Referencing, and have used it
extensively.
Select the Tool and you will get the following screen cap, which itself is very intuitive and the
navigation so easy and user friendly.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
TCommonInspector is a base class that allows to inspect anything in your application. The
example on this page demonstrates TCommonInspector that mimics TDBInspector
with minimal manual code in several events. To use TCommonInspector is enough to define
item count and create handlers for three key events: OnGetName, OnGetValue and
OnSetValue. TCommonInspector has tens other properties and events that can be used for
creating subitems, drop-down lists, calling external editors, customizing and colorizing of
name and value drawing, input validating and much more.
e) Active Perl Browser:
In order to use this, go the following screen after having Active perl installed:
The Browser displayed in the Figure, comes as a default with the standard Active Perl
distribution.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
etc. This is a most common example of Implementation we daily use, ignorant of what's
happening in the background:
Of course it works. But the question is how? All the applications mentioned above are
different, although by the same vendor.
The software applications are different, have you ever thought as to how do the different
applications are interacting in the background to make it work.
· In fact its a typical example of OLE implementation that most computer users
inadvertently use ignorant of what's happening in the background.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Take this handy, keep it deep inside your head as your 2nd nature as an automation
engineer and bet you will have trouble free life.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Objects, methods, properties, accessing and using them. Industry recognized Test
Automation Tools and methods. A practical demo of the same, references urls etc.
So what’s the big deal; The shell scripting is always a part of OS
But there's a lot of fun here. The latest Microsoft Applications are giving the VBA level macro
level support without actually buying the Visual Studio. And that also with the support of 2
different Dev Environments. Please refer to the screen captures for Reference.
Also Please note that Objects actually gives such an intuitive support for methods and
properties and that too so handy. Looks like you don't even need to know programming to do
so.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
can run either of these by typing Wscript.exe or Cscript.exe at the command prompt.
Previously, the only native scripting language supported by the Windows operating system
was the MS-DOS command language. Although MS-DOS is fast and small, its features are
limited compared to VBScript and JScript. For example, the ability to control program flow
was not built into the language. Today, the Windows Script Host architecture allows you to
take advantage of these powerful scripting languages, although support is still provided for
MS-DOS command scripts.
Insights into WSH working: Typically WSH supports scripts that are written in vbs or js. When
a script is started from the desktop/directory/command prompt; the script host reads and
passes the contents of the specified script file to the registered script engine. The script
engine uses file name extensions (.vbs for VBScript; .js for JScript) to identify the script
instead of using the SCRIPT tag (used in HTML). Because of this, you do not have to be
familiar with the exact programmatic identifier (ProgID) of the script engines. The script host
itself maintains a mapping of script extensions to ProgIDs, and uses the Windows association
model to start the appropriate engine for a given script.
A running process is an object: You can query the spawned process, sink its events, access its
standard I/O streams, and share its environment variables with other processes.
The current working directory: You can determine and modify the path of the current working
directory of the active process.
Windows Script Host object modelThe Windows Script Host object model gives you a logical,
systematic way to perform many administrative tasks. The set of COM interfaces that it
provides has two main categories.
Script execution and troubleshooting
Properties and methods directly related to script execution. This set of interfaces allows
scripts to perform basic manipulation of the Windows Script Host, display messages on the
screen, and perform basic COM functions such as CreateObject and GetObject.
Helper functions: Properties and methods for performing actions such as mapping network
drives, connecting to printers, retrieving and modifying environment variables, and
manipulating registry keys. Administrators can also use the Windows Script Host helper
functions to create simple logon scripts.
Object What you can do with this object
WScript Set and retrieve command-line arguments
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Windows platform. For example, administrators can write scripts to manage the Active
Directory directory services.
OLE and Test Automation, and within them you can use any any scripting language as we had
done OLE, like
8. VBS
9. JS
10. Python
get an instance
set avword = createobject(
createobject(word.application)
word.application)
set avdocument = createobject (word.document
(word.document))
'display ord
avword.visible = True
avdocument.saveas “c:\temp\testreport
“c:\temp\testreport\vbs-
\vbs-word.doc
word.doc
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
strResult = ""
Ping "xyz", strResult
Ping "aaa", strResult
Ping "987", strResult
# Our kind of business. networks testing related automation
If strResult <> "" Then
sResult = "Unable to contact following machines:" & vbCrLf & sResult
Set objMail = CreateObject("CDO.Send")
objMail.Profile = "SCB"
objMail.Logon
objMail.NewMessage
objMail.AddRecipient "SMTP:abhinav@indiantestingboard.com"
objMail.Message = "Machine(s) Not Available "
objMail.Subject = strResult
objMail.Send
objMail.Logoff
End If
Option Explicit
Class SysInfo
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
End Function
End Class
use strict;
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Outlook';
my $Outlook = Win32::OLE->new('Outlook.Application');
Win32::OLE->new('Outlook.Application');
my $ol = Win32::OLE::Const->Load($Outlook);
my $namespace = $Outlook->GetNamespace("MAPI");
my $Folder = $namespace->GetDefaultFolder(olFolderInbox);
my $NewMail = $Outlook->CreateItem(olMailItem);
$NewMail->Recipients->Add("abhinav\@indiantestingboard.com
$NewMail->Recipients->Add("abhinav\@indiantestingboard.com");
");
my $error=0;
$NewMail->{Subject} = "$game";
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
$NewMail->{Importance}=2;#2=high,1=normal,0=low
$NewMail->{cc}="abhinav\@indiantestingboard.com";
if ($error==1 )
{
'Procedure GetFolderObj
'Returns a Reference to a Folder object for the specified folder path
'the folder path is specified with the full Exchange folder path
'delimited with backslashes.
'Parameters objSession Reference to MAPI session object
' sFolderSearch Folder path delimited with backslashes
'Returns Referenceto Folder
Function GetFolderObj(objSession, sFolderSearch)
Dim objFolder, objFolder2, objInfoStore, strFolder
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
End Function
'Procedure: StripPath
'Description
'Returns the next level from a folder path
'Parameters sPath Folder path delimited with backslashes
'Returns next level in path.
Function StripPath(sPath)
Dim nF
'look for the next level
nF = InStr(sPath, "\")
'if more levels in path, return name of level
If nF > 0 Then
StripPath = Left(sPath, nF - 1)
sPath = Trim(Mid(sPath & " ", nF + 1))
Else
StripPath = Trim(sPath)
sPath = ""
End If
End Function
'Procedure: CreateFolder
'Description
'Creates a new message folder.
'Parameters objSession Reference to MAPI session object
' sFolderSearch Folder path for new folder, delimited with
' backslashes
'Returns Reference to folder object if successful, otherwise Nothing.
Function CreateFolder(objSession, ByVal sFolderSearch)
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
'Procedure GetAddressObj
'Description
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
# These are the subroutines intented to execute the test cases as per the sanity document
&TC1_2($game);
&TC5($game);
&TC7();
&TC8($game);
&TC9($game);
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
@words=split(/,/,$man[0]);
# Check if the name of the game as entered by the user and as found in the manifest
file match or not
my($game) = shift(@_);
if($game ne $gameName[1])
{
print "TC1 & TC2 - FAIL (There is a mismatch in the name of the game as
entered and that found in the MANIFEST file)\n";
close (MANIFEST);
return;
}
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
$base_location)\n";
close(MANIFEST);
}
}
else
{
print "TC1 & TC2 - FAIL (Jar file not found in the directory
$base_location)\n";
close(MANIFEST);
}
}
else
{
print "TC1 & TC2 - FAIL (Jad file not found in the directory $base_location)\n";
close(MANIFEST);
}
return;
}# sub-end
#======================== TC5
===============================
sub TC5
{
my($game) = shift(@_);
$flag1=0;
$flag2=0;
# Check the read and write attributes for the jad and the manifest files
if(-r $base_location."\\$game.jad")
{
$flag1=1;
}
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
if(-r $base_location.'\MANIFEST.MF')
{
$flag2=1;
}
if($flag1==1 && $flag2==1)
{
$flag1=0;
$flag2=0;
if(-w $base_location."\\$game.jad")
{
$flag1=1;
}
if(-w $base_location.'\MANIFEST.MF')
{
$flag2=1;
}
if($flag1==1 && $flag2==1)
{
print "TC5 - PASS\n";
}
else
{
print "TC5 - FAIL (The attribute \"write\" does not match for the jad and
the manifest file)\n";
}
}
else
{
print "TC5 - FAIL (The attribute \"read\" does not match for the jad and the
manifest file)\n";
}
return;
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
} # sub-end
#======================== TC7
===============================
sub TC7
{
$flag=0;
# Extract the lines out of the manifest file
open(MANIFEST, $base_location.'\MANIFEST.MF') or die "TC7 - FAIL (Manifest file not
found in the directory $base_location)\n";
@man=<MANIFEST>;
while($line=shift(@man))
{
if($line=~ /^MIDlet-1/)
{
$flag++;
}
if($line=~ /^MIDlet-Version/)
{
$flag++;
}
if($line=~ /^MIDlet-Name/)
{
$flag++;
}
if($line=~ /^MIDlet-Vendor/)
{
$flag++;
}
if($line=~ /^MicroEdition-Profile/)
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
{
$flag++;
}
if($line=~ /^MicroEdition-Configuration/)
{
$flag++;
}
}
# If all the lines are found
if($flag == 6)
{
print "TC7 - PASS\n";
}
else
{
print "TC7 - FAIL\n";
}
close (MANIFEST);
return;
} #sub-end
#======================== TC8
===============================
sub TC8
{
my($game) = shift(@_);
open(JAD, $base_location."\\$game.jad") or die "TC8 - FAIL (Jad file not found in the
directory $base_location)\n";;
@words=<JAD>;
$flag=0;
# Check the jad file for any trailing spaces in all the lines that it contains
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
while($line = shift(@words))
{
chomp($line);
if($line =~ /\s+$/)
{
$flag=1;
}
}
if($flag == 0)
{
print "TC8 - PASS\n";
}
else
{
print "TC8 - FAIL\n";
}
close (JAD);
return;
} #sub-end
#======================== TC9
===============================
sub TC9
{
my($game) = shift(@_);
open(JAD, $base_location."\\$game.jad") or die "TC7 - FAIL (Jad file not found in the
directory $base_location)\n";
@words=<JAD>;
while(<JAD>)
{
$line = shift(@words);
}
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
# Check if the last line of the jad file contains the carriage return
if($line eq '')
{
print "TC9 - PASS";
}
else
{
print "TC9 - FAIL";
}
close (JAD);
return;
} # sub-end
#======================== TC9
===============================
# When the sanity test is over, send mail to the respective product owners. This is applicable
only when the release is to be directly sent to the respective product owners bye-passing
(QA), for whatever reasons
# After the sanity test is over, it will open the MSOutlook Client configured on the System
send out mail to the respective Release managers "release_mgrs@alacre.com"
my $Outlook = Win32::OLE->new('Outlook.Application',
Win32::OLE->new('Outlook.Application', 'Quit');
my $ol = Win32::OLE::Const->Load($Outlook);
my $namespace = $Outlook->GetNamespace("MAPI");
my $Folder = $namespace->GetDefaultFolder(olFolderInbox);
my $NewFolder = $Folder->Folders->Add("Test1");
my $newmessage= $
use strict;
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Outlook';
my $Outlook = Win32::OLE->new('Outlook.Application');
Win32::OLE->new('Outlook.Application');
my $ol = Win32::OLE::Const->Load($Outlook);
my $namespace = $Outlook->GetNamespace("MAPI");
my $Folder = $namespace->GetDefaultFolder(olFolderInbox);
my $NewMail = $Outlook->CreateItem(olMailItem);
$NewMail->Recipients->Add("abhinav\@indiantestingboard.com");
my $error=0;
$NewMail->{Subject} = "$game";
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
$NewMail->{Importance}=2;#2=high,1=normal,0=low
$NewMail->{cc}="abhinav\@indiantestingboard.com";
if ($error==1 )
{
In order to execute a WSH-file, use one of two executable files depending on your needs:
WScript.exe for Windows desktop files and CScript.exe is for command-line scripts. You can
set the behavior and appearance of these executed scripts by running the executable without
providing a file; if so, WScript will display a properties page that you can modify, and CScript
will show the available switches. At work, WSH enables you to use more than one scripting
engine in the same file, include typelibraries, and run more than a single job from one file to
name a few.
How about XML Implementation~Object Model
Implemented as an object-model, WSH provides a simple interface for its tasks. As you
author, the WSH file uses XML as its markup for separating the elements. Let's look at a
simple WSH file that prints "Hello Children!".
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
The CreateObject method will create an instance of a given object. In the following example,
we'll see how an ADO Connection object is easily created within WSH.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
$conn = $WScript->CreateObject('ADODB.Connection');
$conn->Open('ADOSamples');
if($conn->{State} == 1) {
$WScript->Echo("Connection Successful!")
}
else {
$WScript->Echo("Connection Failed ...");
}
</script>
</Job>
Figure Number range Figure:
Figure: Perl validations with backend databases
In addition to the above, you can specify a second parameter in the call to CreateObject.
This parameter contains a string which defines a prefix that you specify. By doing so, the
object's outgoing interface is connected and any time an event is fired from the object, you
can intercept it within the WSH file. Lets say for example, in the ADO connection object, there
are a number of events. Sparing the details, WillConnect is called before a connection starts,
and Connectcomplete is called after a connection has been started. They can be easily
intercepted within the WSH file.
# Author: Abhinav Vaid
#Building Automated Test Systems
<Job ID="Test">
<script language=PerlScript>
$conn=$WScript->CreateObject('ADODB.Connection', 'MyWSH_');
$conn->Open('ADOSamples');
if($conn->{State} == 1) {
$WScript->Echo("Connection Successful!")
}
else {
$WScript->Echo("Connection Failed ...");
}
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
sub MyWSH_ConnectComplete {
$WScript->Echo("ConnectComplete was fired ... ");
}
sub MyWSH_WillConnect {
$WScript->Echo("WillConnect was fired ... ");
}
</script>
</Job>
Figure Number range Figure:
Figure: Perl validations with backend 2
For the same result as above, you can use the ConnectObject-method whose syntax is
$WScript->ConnectObject(Object, Prefix);. The method $WScript->DisconnectObject
(Object); will disconnect its event handling provided that the object is connected. Some
other methods are as follows: $Wscript->Echo(1, 2, 3, n); Print text to the standard
output defined by WSH. Separating the arguments cause only a space to separate the items
in a desktop environment and a newline to separate the items in a command-line scenario.
$WScript->GetObject(Pathname [,ProgID] [,Prefix]);
Retrieves an Automation object from a file or an object specified by the strProgID parameter.
$WScript->Quit([$int_errorcode]);
Quit and process and optionally provide an integer which represents an error code.
$WScript->Sleep($int_milliseconds);
Places the script process into an inactive state for the number of milliseconds specified and
then continues execution.
And its properties are:
$WScript->{Application};
Provides the IDispatch interface on the WScript object
$WScript->{Arguments};
Returns a pointer to the WshArguments collection or identifies arguments for the shortcut to
the collection.
$WScript->{Fullname};
Returns a string containing the full path to the host executable file or shortcut object.
$WScript->{Name};
Returns a string containing the friendly name of the WScript object.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
$WScript->{Path};
Provides a string containing the name of the directory where WScript.exe or CScript.exe
resides.
$WScript->{Scriptfullname};
Provides the full path to the script currently being run.
$WScript->{Scriptname};
Provides the file name of the script currently being run.
$WScript->{StdError};
Exposes the write-only error output stream for the current script. Only applicable with CScript
command-line WSH files.
$WScript->{StdIn};
Exposes the read-only input stream for the current script. CScript only.
WScript->{StdOut};
Exposes the write-only output stream for the current script. CScript only.
$WScript->{Version};
Returns the version of Microsoft Windows Script Host.
'creating variable
dim avword
dim avdocument
'getting an instance
set avword = createObject(word.application);
set avdocument = create Object("word.document")
msgbox hau
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Some Specifics:
On a final note, if you are using Cscript.exe and passing arguments to the file, you can read
the arguments as follows:
# Author: Abhinav Vaid
#Building Automated Test Systems
# In All Things be men
Perl for Web testing
<Job ID="args">
<script language=PerlScript>
$arg = $WScript->{Arguments};
$countArgs = $arg->{Count};
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
shortcut that you need to set. The Description-property contains a string describing the
shortcut, Fullname returns the full path to the host executable, Hotkey allows for
combinations such as "ALT+CTRL+X" as hotkeys for shortcuts on the Windows dekstop or
windows startmenu, IconLocation is a property that you set to "Path, index" to provide the
Icon location of the shortcut. In addition, use the TargetPath-property to set the path to the
executable file pointed to by the shortcut, WindowStyle can be set to either 1, 3, or 7 for the
shortcut object, and WorkingDirectory defines the directory in which the shortcut should
start. If you are shortcutting a URL, you have only the Fullname and TargetPath properties
where the latter one is a URL. All shortcut objects are final when you call the Save method.
'The script creates the object for application - this could be ANY app, lets say MicrosoftWord
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "C:\Windows\System32\calc.exe",,False
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
<script language=PerlScript>
$WshShell = $WScript->CreateObject("WScript.Shell");
$numFolders = $WshShell->SpecialFolders->{Count};
$title = "PerlScript & WSH Lets say for Example";
$style = 1;
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
The name is a fully qualified string such as HKCU\ScriptEngine\Val where the same rules
apply for key and value as previously mentioned. The Type-parameter is optional, but if used,
it must be one of the following data types:
• REG_SZ
• REG_EXPAND_SZ
• REG_DWORD
• REG_BINARY
'updatejob.vbs
'copy job file from logon location to Tasks folder
Const WindowsFolder = 0
Dim objShell, strPath, objFSO, strVal
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
'updfiles.vbs
'copy files upon logon
Dim strPath, objFSO, strVal, objShell, strCopyPath
strPath = objShell.ExpandEnvironmentStrings("%LDIR%")
On Error Resume Next
'get Reference to registry flag
strVal = _
objShell.RegRead("HKCU\SOFTWARE\WSHUpdates\DeskTopShortcutsUpdate1")
'if registry key didn't exist, then copy files to desktop
If IsEmpty(strVal) Then
strCopyPath = objShell.SpecialFolders("Desktop") & "\"
objFSO.CopyFile strPath & "E-mail Policy.doc.lnk", strCopyPath, True
objFSO.CopyFile strPath & "Phone List.doc.lnk", strCopyPath, True
'update registry entry to reflect the operation has been performed
objShell.RegWrite "HKCU\SOFTWARE\WSHUpdates\DeskTopShortcutsUpdate1", _
Date
End If
strVal = Empty
'get Reference to font update flag under local machine
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
strVal = objShell.RegRead("HKLM\SOFTWARE\WSHUpdates\TreFontUpd")
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
End With
End Sub"
Figure 2:
Note: If, while recording, you selected a cell, your macro may contain something similar to
Range("A3").Select. You may want to remove this line, since every time the macro is run,
this line will force the cell specified in the Range object to be selected. If you want that cell to
be selected first then leave that line in the macro.
Now, we can modify the code slightly and add one of the various looping structures to the
recorded code.
For Each...Next Loop
If we know what range of cells to which we want to apply the recorded action, we can use a
For Each…Next loop. In this example, we also want to only affect the cell in column B if the
cell in A is greater than 20. To do this we add an If statement around our recorded With
statement. This will ensure the color will be changed only if the If statement's condition is
true. Lastly, because we are wanting to change the corresponding cell one column to the
right of column A (column B), we will
replace the Selection property in the recorded code with the Offset method of the looping cell
object (cell_in_loop). The resulting code might look like this
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Here the Selection object is being used so that the code is not specific to any given range, but will
always loop through ten (0 to 9 as a counter) cells below the active cell. The Counter variable
increments each time through the loop and can be used within the looping structure. Here it is used as
an Offset argument to indicate how many rows to offset from Selection (the current cell). So, if we start
this macro and the active cell is A1, the first time through the loop the Counter variable will equal 0,
therefore we will Offset 0 rows from A1 as shown in the Selection.Offset(Counter, 0).Value statement.
Do…Loop
To determine whether or not to stop a loop based on a certain condition, a Do…Loop might be
appropriate. This looping structure allows you to check properties or variable conditions before the loop
is executed. In the sample below, we continue to loop until the referenced cell's row
number, Selection.Offset(Counter, 0).Row, has exceeded 100. This can be useful if you never want to
perform the looping task below row 100.
# Author: Abhinav Vaid
#Building Automated Test Systems
"Sub Do_Loop_Sample()
Counter = 0
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
· Note: There are three more types of Do…Loops available. The various forms offer more flexibility
when needed in various circumstances.
To find more information about these, and more detail about the other looping structures, please access
Help from within the Visual Basic Environment and use the keyword looping.
Working with Arrays: The most common way to transfer the contents of an array to a worksheet is
through a loop, such as a For...Next loop. A For...Next loop allows you to index into the array and
transfer elements of the array to their destination address one at a time. You can accomplish this same
result without a loop using the Visual Basic, Applications Edition, FormulaArray property of the Range
object.
In Visual Basic, Applications Edition, the orientation of a one-dimensional array is horizontal. Therefore,
if the range of cells on a worksheet that are to receive the contents of an array are also in the same
orientation (that is, one row by several columns), the contents can be transferred with a single
FormulaArray statement. Lets say for example:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
The two-dimensional array shown in this example allows Visual Basic to set the orientation of the array
as vertical; therefore, the array can be transferred to a worksheet without a loop."
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
.Selection.TypeParagraph
'Paste the chart
.Selection.PasteSpecial link:=True, DisplayAsIcon:=False, Placement:=wdInLine
End With
Set wd = Nothing
End Sub"
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
conn.Close
End Sub
Figure Number range Figure
What is WSH
WSH is another technology by Microsoft that supports automation, the same automation has
been done by using this technology and 2 popular scripting languages.
Internals of WSH: WSH works with the support of runtime scripting lib, provided by Microsoft.
In case you are interested, you can go to %windir%\system32\scrunn.dll
This also could have been done using all the above mentioned scripting languages.
· Perl/Active Perl: Using WSH and Perl for Test Automation
· Vbs: Using VBS and WSH for Test Automation
So what you going to witness is same thing being automated using 10 different technologies,
sounds interesting, isn't it. Wish, I had read a similar book would have been
Windows Scripting Host (WSH) is a set of 3 files:
Wscript.exe
Cscript.exe
Wsh.ocx
Automating/Scripting Playing with Internals:Developers up the wall!!!
There was a mention of touching the extremes with respect to the bug logging practices and
avoiding the reproduce ability related fire fighting between testing and development Teams.
· Another typical recommendation with respect to the above topic is
having a bug scrub periodically where in all the product owners are
present, and take a call on prioritization, severities, and so on. Although
the book is not intended for this but the current topic definitely is.
Although it calls for a fair amount of hardwork to be done from a Testers perspective as it
requires a fair amount of understanding of Operating System Internals in addition to the
Scripting skill sets.
Who said that life was an easy game !!!
Expands the requested environment variable from the running process:
$WshShell->ExpandEnvironmentStrings($string);
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
In addition, log an event in the NT event log or WSH.log (Windows 9x) file using:
$WshShell->LogEvent(Type, Message [,Target]);
Target is the name of the system on NT, thus only applicable on NT. The Type of event is
either
0 (SUCCESS)
1 (ERROR)
2 (WARNING)
4 (INFORMATION),
8 (AUDIT_SUCCESS)
16 (AUDIT_FAILURE)
This method returns a boolean value indicating success or failure. Another method is Popup,
which sends a Windows messagebox up on the screen.
$retval = $WshShell->Popup(Text, [SecondsWait], [Title], [Type]);
The method allows you to define the text to pop up, alternatively seconds to wait before
closing window, the title of the window, and lastly the type of buttons available in the
window. They can be:
0 (Ok)
1 (Ok and Cancel)
2 (Abort, Retry, and Ignore)
3 (Yes, No, and Cancel)
4 (Yes and No)
5 (Retry and Cancel)
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Note that CPU Time column is mostly 0 (explained later) To determine which process is
consuming the most CPU time, sort processes by “CPU” usage column
Processes And Threads
What is a process?
Represents an instance of a running program You create a process to run a program
Starting an application creates a process Process defined by Address space
Resources (e.g., open handles) Security profile (token) What is a thread?
An execution ext within a process Unit of scheduling (threads run, processes don’t
run) All threads in a process share the same preprocess address space
Services provided so that threads can synchronize access to shared resources (critical
sections, mutexes, events, semaphores) All threads in the system are scheduled as
peers to all others, without regard to their “parent” process
Per-process
address space
System-wide
Address Space
Thread
Thread
Thread
Type: tasklist /svc tasklist /svctasklist /svctasklist /svc
(C) 1985-2001 Microsoft Corp.
C:\Documents and Settings\naudee>cd\
C:\>svchost
C:\>tasklist /svc
Image Name PID Services
========================= ======
=============================================
System Idle Process 0 N/A
System 4 N/A
smss.exe 432 N/A
csrss.exe 488 N/A
winlogon.exe 512 N/A
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
WinLogon
SaveDump
User mode
Kernel mode
1
2
3
4
At The Reboot
Session Manager process (\Windows\system32\smss.exe) initializes
paging file NtCreatePagingFile NtCreatePagingFile determines if the dump has a crash header
Protects the dump from use Note: crash dump portion of paging file is in use during the copy,
so virtual
memory can run low while the copy is in progress WinLogon calls NtQuerySystemInformation
to tell if there’s a dump to extract If there’s a dump, Winlogon executes SaveDump
(\Windows\system32\savedump.exe) Writes an event to the System event log SaveDump
writes ents to appropriate file On XP or later, checks to see if Windows Error Reporting should
be invoked
1
2
3
4
Why Would You Not Get A Dump?
Most common reasons: Crash occurred before paging file was open
E.g. a crash during driver initialization Paging file on boot volume is too small
Not enough free space for extracted dump Less common:
The crash corrupted components involved in the dump process
Miniport driver doesn’t implement dump I/O functions Windows 2000 and
beyond storage drivers must implement dump I/O to get a Microsoft® signature
How do you troubleshoot a system that is crashing with no resulting dump?
Online Crash Analysis (OCA) By Default, after a reboot
XP/Server 2003 prompts you to send information to
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Enter “srv*c:\symbols*http://msdl.microsoft.com/download/symbols”
If a minidump, must also configure image path to point to
location of images (File->Image File Path)
Use same string as for symbol server (XP and beyond)
OutlineCrash dumps and toolsAnalysis basicsIRQLsStacksAnalyzing an “easy” crash
Un-Analyzable crashesCrash transformationBuffer overrunCode overwrite
Manual analysisHung SystemsWhen there is no crash Key IRQLs
PASSIVE_LEVEL:No interrupts are maskedUser mode code always executes at
PASSIVE_LEVEL
Kernel-mode code executes at PASSIVE_LEVEL most of thetimeDISPATCH_LEVEL:Highest
software interrupt levelScheduler is off Page faults cannot be handled and are illegal
operations
StacksThe stack is the #1 analysis resourceIt requires that a driver get “caught in the act”
Sometimes that’s not possible without the Driver Verifier’s helpEach thread has a user-mode
and kernel-mode stackThe user-mode stack is usually 1 MB on x86The kernel-mode stack is
typically 12 KB on x86 systemsStacks allow for nested function invocationParameters can be
passed on the stack
Stores return addressServes as storage for local variables Crash dumps and toolsAnalysis
basicsIRQLsStacksAnalyzing an “easy” crashUn-Analyzable crashesCrash transformationBuffer
overrun
Code overwriteManual analysisHung SystemsWhen there is no crash dumpNotMyFault.exe
Test program and driver todemonstrate common crashscenariosIt loads
MyFault.sysMyFault.Sys has an IOCTLinterface that implementsdifferent bugsGet it
at:http://www.sysinternals.com/files/notmyfault.zip
MyFault.sys
IOCTL Interface
User Mode
Kernel Mode
enerating a Straight-Forward Crash Run NotMyFault and select “High IRQL fault (kernel
mode)” Allocates paged pool buffer Frees the buffer Raises IRQL ≥ DISPATCH_LEVEL
Touches the buffer Paged buffers that are marked “not present” but are
touched when IRQL ≥ DISPATCH_LEVEL result in theDRIVER_IRQL_NOT_LESS_OR_EQUAL
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
bug check
Page fault handler calls KeBugCheckEx from page faulthandlerThe IRQL is not less than or
equal to the maximum IRQL atwhich the operation is legal (which is < DISPATCH_LEVELHigh
IRQL Fault Analysis
!analyze says “memory corruption”!analyze –v easily identifies MyFault.sys by
looking at the KeBugCheckEx parametersDisplays the faulting IP in Myfault.sysCrash dumps
and tools
Analysis basics
IRQLs
Stacks
Analyzing an “easy” crash
Un-Analyzable crashes
Crash transformation
Buffer overrun
Code overwrite
Manual analysis
Hung Systems
When there is no crash dump
Crash Transformation
Many crashes can’t be analyzed
The “victim” crashed the system, not the criminal
The analyzer may point at Ntoskrnl.exe or
Win32K.sys or other Windows components
Or, you may get many different crash dumps all
pointing at different causes
You’re goal isn’t to analyze impossible
crashes…
Its to try to make an “unanalyzable” crash into one
that can be analyzed
4-33
Crash Transformation Recipe
The tool for crash
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Buffer
Signature
Higher
Addresses
Page n
Page n+1
Page n+2
4-39
Turning on Special Pool
You get Special Pool when you enable the Verifier
The Verifier Catching Buffer Overrun
The Driver Verifier catches the overrun when it occurs
The blue screen tells you who’s fault it is
!analyze explains the crash and also tells you the buggy driver
name
The stack shows where the driver bug is
4-41
Un-Analyzable Crash:
Code Overwrite
Caused when a bug results in a wild pointer
A wild pointer that points at invalid memory is easily detected
A wild pointer that points at data is similar to buffer overrun
Might not cause a problem for a long time
Crash makes it look like its something else’s fault
System code write protection catches code overwrite, but
it’s not on if:
It’s a Windows 2000 system with > 127 MB memory
It’s a Windows XP or Server 2003 system with > 255 MB
Causing a Code Overwrite
Run NotMyFault and select “Code Overwrite”
Overwrites first bytes of nt!ntreadfile
Function is most common entry to I/O system so a random thread will
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Manual Analysis
Sometimes !analyze –v isn’t enough
Doesn’t tell you anything useful
You want to know what was happening at the time of the crash
Useful commands:
List loaded drivers: lm kv
Make sure drivers are all recognized and up to date
Look at memory usage: !vm
Make sure memory pools are not full
If full, use !poolused (requires pool tagging to be on)
Examine current thread: !thread
May or may not be related to the crash
List all processes: !process 0 0
Make sure you understand what was running on the system
If a Verifier detected deadlock: !deadlock
Booting in Debugging Mode
If you have hangs or crashes with no resulting dump (or other
“spontaneous reboots”)
…you need to get into the kernel debugger at the time of the crash
Boot in Debugging Mode
Two options to boot in debugging mode:
1. Press F8 during the boot and choose “Debugging Mode”
2. Or, edit the target’s boot.ini file to configure:
/debugport=comX /baudrate=XXX (note: default baud rate in Debugging
Mode is 19200)
Windows XP and 2003 support 1394
In either case, this loads the kernel debugger at boot time
Does not affect performance
But, system will not auto reboot after a crash, even if configured to do
so!
4-47
Debugging System in Debugging Mode
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
4-50
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
5-6
x86 and x64 Boot Process
3. NTLDR (screen is black)
Moves system from 16-bit to 32-bit mode and enables paging
Reads and uses Ntbootdd.sys to perform disk I/O if the boot
volume is on a SCSI disk
Uses BIOS to read from system volume’s disk
This is a copy of the SCSI miniport driver used when the OS is
booted
Reads Boot.ini
Boot.ini selections point to boot drive
Specifies OS boot selections and optional switches (most for
debugging/troubleshooting) that passed to kernel during boot
If more than one selection, NTLDR displays boot menu (with
timeout) If you select a 64-bit installation, NTLDR moves the CPU into
64-bit mode
NTLDR Once boot selection made, user can type F8 to get to special
boot menu Last Known Good, Safe modes, hardware profile, Debugging
mode NTLDR executes Ntdetect.com to perform BIOS hardware
detection (x86 and x64 only) Later saved into HKLM\Hardware\Description
NTLDR loads the SYSTEM hive (HKLM\System), boot drivers,
Ntoskrnl.exe, Hal.dll and transfers rol to main entry point of
Ntoskrnl.exe Boot driver: critical to boot process (e.g. boot file system driver)
4. Ntoskrnl (splash screen appears)
Initializes kernel subsystems in two phases: First phase is object definition (process, thread,
driver,
etc) Second builds on the base that the objects provide This is done in the ext of a kernel-
mode system thread that becomes the idle threadI/O Manager starts boot-start drivers and
then
loads and starts system-start drivers inally, Ntoskrnl creates the Session Manager
process (\Windows\System32\Smss.exe), the first user-mode process
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Boot.ini Problems
Symptom:
NTOSKRNL complains that boot device is
inaccessible
Cause:
Boot.ini is missing or corrupt
Boot.ini is out-of-date because a partition has been
added
5-20
Boot.ini Problems
Troubleshooting:
Boot into RC
Run Bootcfg /rebuild
5-21
Agenda
The boot process
MBR corruption
Boot sector corruption
System file corruption
Boot.ini misconfiguration
Crashes or hangs
Registry SYSTEMHive Corruption ymptom:
NTLDR reports that System hive is corrupt
Causes:Disk is corruptSystem hive is corrupted or deleted
Registry SYSTEM Hive Corruption
Troubleshooting:
Boot into RC
Run Chkdsk
If no errors, need to get a backup of the SYSTEM hive
On XP with System Restore enable, look in \System Volume
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Information
Go to \_restore{xxx}\RPnnn\snapshot
Copy _REGISTRY_MACHINE_SOFTWARE to
\Windows\System32\Config\System
Otherwise, copy from \Windows\Repair
This backup is created by Windows Setup
Backing up “System State” with Windows Backup update the
Repair directory
System File Corruption
Symptom:Error message indicating that NTLDR, NTOSKRNL.EXE,
HAL.DLL or other system file is missing or corrupt
Blue screen with corruption message
System File Corruption
Causes:
Disk is corrupt
File is missing or corrupt
Troubleshooting:
Boot into RC
Run Chkdsk
If no chkdsk errors obtain clean copy of file and replace file
Check in \Windows\System32\DLLCache for backup
If not there, get a replacement from an identical system i.e. from
same hotfix or service pack
If can’t find replacement use Automated System Recovery
(ASR) or some other disk image restore utility
AgendaThe boot processMBR corruption
Boot sector corruptionBoot.ini misconfiguration
System file corruptionCrashes or hangs5-28
Post-Splash Screen Crash or Hang
Symptoms:
System blue screens on boot
Hang before logon prompt appears
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
5-36
Safe Mode Description
HKLM\System\CurrentrolSet\Safeboot guides safe
mode by specifying names and groups of drivers
Normal, Network, Command-Prompt
No networking in Normal
Networking includes networking services
Command-Prompt is same as Normal except launches
Command Prompt instead of Explorer as shell for when Explorer
shell extensions cause logon problems
Directory Services Restore Mode: not for boot troubleshooting
(for repairing or restoring Active Directory database from
backup)
Safe Mode Internals
Registry keys guide what’s in safe modes:
HKLM\System\CurrentrolSet\SafeBoot\Minimal is for
Normal and Command-Prompt
HKLM\System\CurrentrolSet\SafeBoot\AlternateShell
specifies shell for Command-Prompt boot
HKLM\System\CurrentrolSet\SafeBoot\Network is for
Network rivers and services must be listed by name or by group to be
loaded
Exception: all boot-start drivers load regardless
What are Windows Script Components? How are they associated to OOPS and/or COM/DCOM
Windows Script Components provide you with an easy way to create powerful, reusable COM
components in script. You create script components using any scripting scripting language
that supports the Microsoft ActiveX® Scripting interfaces. Script languages that support these
interfaces include JScript, Microsoft Visual Basic® Scripting Edition (VBScript), PERLScript,
PScript, and Python.
This new script component technology supports common types of COM components, such as
Automation, and is extensible with add-ons such as DHTML behaviors.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Like Other implementations, WSC's can also be implemented using any scripting language.
But yes there is a limitation: Support for Interfaces is mandatory. But on the positive side, it
also supports Perl code directly embedded into Windows Script Components (WSC's).
As mentioned earlier, COM is just a set of guidelines for compliances. And from
Tester's automation perspective, I would not recommend to go in depth of COM
as there is a whole world out there.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
<registration>
description="Easy"
progid="Easy.WSC"
version="1.00"
classid="{74bb1ba9-2e69-4ad6-b02c-c52f3cbe153b}"
</registration>
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
<public>
<method name="SayHello">
</method>
</public>
<script language="PerlScript">
<![CDATA[
]]>
</script>
</component>
As seen above, you have a Window Script Component that is an XML file. The first declaration
of the WSC enables strict XML. In that mode, the elements and attributes are case-sensitive,
and attribute values must be enclosed within single quotes or double quotes. You may omit
the XML declaration on top of the document and it will not be compiled as strictly, but in
these examples, we will stick with XML conformity and leave the declaration in each
document. Note: XML elements is that they, like HTML, have tag pairs like "<registration>"
and "</registration>".
Secondly, you have a component element. This element is used to enclose each component.
You will place one at the beginning, and one at the end. As an exception to the rule, there is
an element that has a higher priority than the component, and that element must be used
whenever you keep more than one component in your WSC file. Is is the package element. It
will as a single element enclose all components; however, as mentioned, it is not required
when you have one component within the file.
Next, the registration element contains the information about your component such as the
progid, classid, description, and version number. Description is a string in which you can write
a short abstract summary the funcitonality of your component. The progid is used by the
program which creates an instance of your component, and the version number should be
incremented if you release a new version of your component. The version number can also be
appeneded to the progid as as Easy.WSC.1.00 when creating the instance of your component.
After the registration element, the data and functionality that the component expose are
defined. The public element will hold properties, methods, and events. We declare a method
by the name "SayHello" and then skip on down to the script-elements. As you can tell, there
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
is no source code, so we need to fill that out. In the empty space, enter the following:
sub SayHello {
my($param) = shift @_;
return reverse($param);
}
<?xml version="1.0"?>
<component>
<registration>
description="Easy"
progid="Easy.WSC"
version="1.00"
classid="{74bb1ba9-2e69-4ad6-b02c-c52f3cbe153b}"
</registration>
<public>
<method name="SayHello">
</method>
</public>
<script language="PerlScript">
<![CDATA[
sub SayHello {
my($param) = shift @_;
return reverse($param);
}
]]>
</script>
</component>
How do we do it Manually:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
<?xml version="1.0"?>
<component>
<registration>
description="First"
progid="First.WSC"
version="1.00"
classid="{d0ccb637-bd0c-4c90-a4bd-7473f499d35a}">
<comment> This makes the messagebox pop up on registration and unregistation </comment>
<script language="PerlScript">
<![CDATA[
use Win32;
sub register {
Win32::MsgBox('Windows Script Component says: First.WSC has been registered!');
}
sub unregister {
Win32::MsgBox('Windows Script Component says: First.WSC has been unregistered!');
}
]]>
</script>
</registration>
<comment> The methods and properties to expose to the data consumer </comment>
<public>
<property name="YourName">
<get internalName="hiddenGetProperty"/>
<put internalName="hiddenSetProperty"/>
</property>
<method name="SayHello">
</method>
</public>
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
<comment> The code that implements the functionality of the component </comment>
<script language="PerlScript">
<![CDATA[
use vars qw($YourName_Property);
sub hiddenGetProperty {
return $YourName_Property;
}
sub hiddenSetProperty {
my $param = shift;
$YourName_Property = $param;
}
sub SayHello {
return "Hello $YourName_Property!";
}
]]>
</script>
</component>
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Advent of Perl Architectural Insights and background. The latest Perl Implementation is
derived from the same old Perl which was already in place. And it made a lot of sense to
enhance it and extend it rather than changing the vary architecture itself. And it would have
made lot more sense to have it and enhance it so that it does not break the level of maturity
that per had managed to reach.
Also note that perl is not built for making business or use as a commercial tool. It was
engineered by people like us, who had a common ajenda to contribute to the industry either
as a contribution or as a support.
So in order to support for COM and Object referencing a methods and support via various
modules, packages, functions, references and so on.
The Perl object architecture relies heavily on packages, subroutines, and references, so if
you're skipping around in this book, please go back to the beginning. Ready? Here we go.
Win32::Internet
use Win32::Internet;
$INET = new Win32::Internet();
$file = $INET->FetchURL(“http://www.indyacellular.in”);
binmode STDOUT;
print $file;
Open HTTP session
use Win32::Internet;
$INET= new Win32::Internet();
$INET->HTTP($HTTP, “hostname
“hostname”,
”, “ username”, “password”);
#---------------------------------------------------------
# @ in email address must be escaped e.g.,
# abhinav\@indiantestingboard.com
#---------------------------------------------------------
($statuscode, $headers, $file)=$HTTP->Request(“/”);
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
binmode STDOUT;
print $file;
Open FTP session
use Win32::Internet;
$INET= new Win32::Internet();
$INET->FTP($FTP, “hostname
“hostname”,
”, “username”, “password”);
$FTP->Cd (“path”);
$FTP->Binary ();
$FTP->Get(“myfile.zip”); # file saved to myfile.zip
$FTP->Close();
FTP Function Reference
$FTP->Ascii();
$FTP->Binary();
Sets the ASCII (Binary) transfer mode for
this FTP session.
$FTP->Cd("/pub"); Changes the current directory on the FTP
remote host.
$FTP->Delete("yourfile.zip"); Deletes a file on the FTP remote host.
$FTP->Get("myfile.zip"); Gets the remote FTP file and saves it.
$FTP->Put("newfile.zip"); Upload a file to the server.
@files = $FTP ->List("*.txt"); Returns a list containing the files in
current directory.
$FTP->Mkdir("NextBuild"); Creates a directory on the FTP remote
host.
$path = $FTP ->Pwd(); Returns the current directory on the FTP
server.
$FTP->Rmdir("olddir"); Removes a directory on the FTP remote
host.
$FTP->Rename("old.zip",
"new.zip"); Renames a file on the FTP remote host.
Win32 API Functions
#-------------------------------------
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
number of the operating system, the minor version number, the build number,
and a digit indicating the actual operating system. For ID, the values are 0 for
Win32s, 1 for Windows 9X and 2 for Windows NT. In scalar context it
returns just the ID.
Win32::MsgBox(MESSAGE [, FLAGS [, TITLE]])
Create a dialogbox containing MESSAGE. FLAGS specifies the required
icon and buttons according to the following table:
0 = OK
1 = OK and Cancel
2 = Abort, Retry, and Ignore
3 = Yes, No and Cancel
4 = Yes and No
5 = Retry and Cancel
MB_ICONSTOP "X" in a red circle
MB_ICONQUESTION question mark in a bubble
MB_ICONEXCLAMATION exclamation mark in a yellow triangle
MB_ICONINFORMATION "i" in a bubble
TITLE specifies an optional window title. The default is ``Perl''.
The function returns the menu id of the selected push button:
0 Error
1 OK
2 Cancel
3 Abort
4 Retry
5 Ignore
6 Yes
7 No
Win32::DomainName()
Returns the name of the Microsoft Network domain name.
Win32::FsType()
Returns the name of the filesystem of the currently active drive (like 'FAT' or
'NTFS'). In list context it returns three values: (FSTYPE, FLAGS,
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
On the Internet, ASP serves documents of its own filetype as opposed to familiar document
types like HTML documents. This is so that the ASP document can be processed on the server
side before returned to the client's browser. An ASP document has the file extension .asp, and
it provides both existing features derived from ASP and the ability to execute script
commands within the document. The file extension is by the webserver recognized in a
special way which results in the underlying technology executing script commands that are
within the file and treat other markup such as HTML in a standard fashion. The source code of
your saved file's PerlScript script commands will by default never be available to the user
when choosing to view the document source in the browser, so any script that you write can
not be copied. The reason for this is because everything is processed on the server side and
what is returned to the browser is a standard format such as HTML.
For a closure, it deserves to be repeated that if you are unfamiliar with object-oriented
programming in Perl, it is strongly recommended that you sometime browse the Perl
documentation on object-oriented programming to get a basic understanding of the aspects
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
of an object and its origin. Next up, let's look at how to embed PerlScript commands within an
ASP document.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
#
# Your Perl code here
#
}
</SCRIPT>
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
within which you use PerlScript so that you know what object to call and how to get the best
performance out of your application.
If it instead of finding the file reports an error such as "File Not Found," you need to open
Windows Explorer and reassure yourself of that the file is saved with the .asp file-extension
and in the correct physical location for being accessible by the browser. If the browser finds
the file and "Hello Children" is outputted, you can place a few script commands in the file and
rest assured that ASP will execute everything as for which it was built. Edit the file so that is
looks as follows.
# Author: Abhinav Vaid
#Building Automated Test Systems
<%@Language=PerlScript%>
<HTML>
<TITLE> PerlScript Test </TITLE>
<%
for($i=0; $i<=10; $i+=2) {
$Response->Write("<FONT SIZE=$i COLOR=#000000>");
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
WScript.Sleep 1000
'now we need to activate the windows. we need it's window
'title, which by experimentation we've determined Is
'"Untitled - Notepad." You don't need the EXACT title;
'Windows will try to activate the first matching window
'it finds
objShell.AppActivate "Untitled - Notepad"
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
In object-oriented programming, the tester is required to create an instance of the object the
tester wishes to use. The ASP objects, on the other hand, are "intrinsic", which means that
they are already instantiated and available to your scripting language engine. No pre-work at
all is associated with these objects and you can access them at any time. Now, each object
encapsulate a set of very specific services and provides shorthand access to common tasks for
the web developer such as reading the data submitted from a web-form, reading and writing
cookies, redirecting the client's browser, and also extended functionality such as the ability to
identify each user as a unique client and associate private server-side variables with her.
Before diving into the syntax, these are the objects as of ASP 3.0:
Application
The Application Object an object that is a place-holder for global variables stored on the
server side. A global variable in this sense is a variable that is global to what is known as the
IIS application. The IIS application defines the physical space of a webserver such as the
range on the hard disk for the URL http://members.someperlsite.com/. A webserver can have
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
more than one IIS application, but there is only one ASP application object per IIS
application. Confused? Hang on a minute. The Application object, like the Session object, has
what is called a collection. The collection contains variables created by you. Whenever you
want to create a variable, the variable must be put on the contents collection, and the
following is one way of doing it.
The contents collection can store scalar variables, arrays, or objects that somehow are
associated with all users; for example, a visitor counter or a connection-string used to
connect to a database through the Microsoft universal ADO application-programming
interface. The variable can be accessed easily, too.
However, when you're comfortable within the Microsoft Management Console and can set and
define your own IIS applications, you will notice that there is only one ASP Application object
per IIS Applcation and the variables placed in the Contents colleciton are only available within
that IIS application and no other. If it's a bit confusing, it's guaranteed to have cleared out
after playing around with this for a while. It's the most abstract part about ASP if you are not
used to defining IIS applications. On the downside, Personal Web Server does not enable you
to define more than one IIS application.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
descriptions about the error. You can with PerlScript easily also extend the use the 500-
100.asp page to perform custom tasks such as emailing you a formatted page of the contents
of the ASPError object on an arror or writing it to a special log. Some of its useful properties
include: SourceCode for returning the source code of the part of a script that generated the
error, Category for tracking down the categoru of the error to ASP, scripting language, or an
object, File for the name of the file processed when error was generated, and Description to
return a description of the error; however, please note that ASPError objects are only
returned by the Server object's GetLastError method.
ObjectContext
The ObjectContext object is used for a page that is run as a transaction. This object enables
you to commit or abort a transaction, which is an important functionality for deployed
business applications. Its only methods are SetAbort() and SetComplete(). They are used to
commit or abort the transaction. Before this can be used, your page must include a
@TRANSACTION page command in the page, whereas you are enabled only to define @ once
per file; however, you can use multiple directives within the @ such as <%
@directiveA=something directiveB=somethingelse%>. If you use PerlScript a lot, you are
better off setting it as the default language in the Microsoft Management Console. Setting the
default language in the MMC is unfortunately not an option for Personal Web Server. PWS is
good for practicing a scripting language and ASP, but it is not good for tailormaking your
webservice in terms of IIS applications and other tasks that are administrative. Lets say for
example, it does not have the Microsoft Management Console. What PWS mainly does is to
allow you to publish and develop Active Server Pages within reson while it hides the
administrative tasks.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Request
For good reason, the Request object is a widely used object. It contains a collection of
information such as form-data or cookies gathered from the client. With this object you can
gather the contents submitted from any type of web-form, read server variables or the
contents of a digital client certificate. You can also read binary data such as an uploaded file
by first determining the number of bytes sent with the TotalBytes-property and then read it
with the BinaryRead($bytes_to_read) method.
In the Request object, collections that you can read includes ClientCertificate for digital
certificated, Cookies for cookies sent with the HTTP request, Form for data posted by a web
form using the POST method, QueryString for data passed with the QueryString or GET
method from a web form, and ServerVariables for HTTP environment variables such as the
server software or the users browser.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
You can use CreateObject('ProgID') to return a valid COM object to the Active Server
Page. Lets say for example, to instantiate an ADO object, you'd do the following:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
When using strings, HTMLEncode($string) encodes charaters such as greater than and less
than into its valid character represenation within an HTML page. This prevents, for example,
users to post HTML to a chatroom or messageboard. The URLEncode($string)-method encodes
a string for valid represenation as a URL. New in IIS 5, you can Execute('/scripts/page.asp')
ASP scripts in other files, and to transfer the user without losing the state of the Request
object's existing variables such as the contents of the Form-collection you can use the
Transfer-method.
Worth noting about the transfer method is that it takes place on the server side. There is
never a request sent to the users browser telling the browser to redirect, thus a roundtrip is
spared.
Session
The Session object enables you to associate variables with each unique client and keep the
variables stored until the tester leaves the domain. It has the same abilities as the Application
object, but with the important difference that these variables will only be available to the
single user and the script engine, making it ideal for applications such as shopping carts. The
syntax is the same as the Application object in terms of adding entities to the Contents
collection. In addition, you can set the Timeout-property to the number of minutes that you
wish the Session to last before it is ended or you can deliberately end the Session by calling
the Abandon-method and then redirect to a new page. The redirection is very important!
Other properties that you can use is CodePage which is used for Symbol Mapping, LCID for
the locale identifier, and SessionID which uniquely identifies the client.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
For both the Session and Application object, the Contents collections contain a Remove() and
RemoveAll() method. Remove() takes either an index or a keyname for the variable in the
Collection to remove, and RemoveAll() removes all variables stored in the collection. In
example, consider that you have stores a property called "myName" in the Session s Contents
collection, you would remove it as follows
Had I been the audience, I would have asked “Why Js for Test Automation”, and the question
does make sense to me.
The answer is clear and simple, Js is mostly targetted for Browser related development
(whether it is for client/server or from any xyz vendor microsoft, netscape etc. And at times,
Js could be better and simple than any other scripting language.
Object Implementation in Java Scripting: Object Oriented Implementation in JS is relatively
simple and breeze. It identifies everything as objects.
1. Objects have properties
2. Objects perform actions
3. Objects have methods, interfaces associated which we use to do Automation
The most important from our subject I find is Window objects.
Lets take an example for testing Interactiveness:
var name = window.prompt("What is your name ?","");
Implementing/Testing Url's/ The location object identifies the current document and consists
of a complete URL. URL stands for Information can be sent to an another web page using a
search string.
DOCUMENT OBJECTS The document object has all the HTML elements attached to it. Anchors,
forms, history and link objects. document objects and the objects . You have already used the
write method of the document object when you have written a message to the web
browserYou can also make anchors and links using JavaScript. You use the String object and
the anchor() method of the string object to make an anchor in Java Script. A string object is
automatically made for you when you use a string value . Strings values are text enclosed in
double quotes like "I am a string". The string object holds the string text. string_name.anchor
(anchorName);
var top = "you are at the top";
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
document.write(top.anchor("top"));
You use the String object and the link() method of the string object to make a link in Java
Script.
string_name.link(href);
var jump = "click here to go to the top";
document.write(jump.link("#"+"top")+"<br>");
<html>
<head>
<script language=”JavaScript”>
<!-
document.write(“I like JAVA script”);
//-->
</script>
</head>
<body>
</body>
</html>
Type the above code into an HTML file type Hello Children.
Invoke the Browser.
Runtime dependency: The Browser should have js enabled
Variables in JavaScript can be used right when you need them. The variable can represent a
string or a number depending on how it is used. We can demonstrate the use of a variable by
using a JavaScript window object and the prompt method of the window object to get an
input string from the keyboard. You will learn about all of the JavaScript objects shortly. Its
good to knowWe use the prompt method on a window object to get a person’s name from the
keyboard.
var name = window.prompt (“What is your name ?”, "");
The window prompt method allows you to display a message and an optional initial value to
appear in the place where you enter your name. We have set this initial value to "" which
means display no value.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
What are Interface Handlers: Interface handlers, are the compiled components intended to
implement specific COM interfaces. Different interface handlers come ready to work as
specific types of COM components.
The most commonly used interface handlers, including the COM Automation interface handler,
an ASP interface handler, and a handler for DHTML Behaviors, are already built into the script
component run-time. Others are available as add-on components, or embedded into specific
applications.
What is wsc? A typical script component file is nothing but a “.wsc” file. Script component
files are XML (Extensible Markup scripting language) files that contain information about what
type of COM component you want to create (that is, what interface handlers you want to
use). Then, depending on what functionality the handler makes available, you write script in
your script component to implement those interfaces.
The script component run-time serves as an entry point for the host application. The
complexities of COM, including the implementation of such COM-standard interfaces as
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Note The script component run-time includes interface handlers for Automation (exposed
using the <public> element), for ASP, and for Internet Explorer 5.0 DHTML Behaviors. Other
interface handlers are available as external DLLs. For more information about additional
interface handlers and script components, see the Microsoft Scripting Technologies Web site.
<script> element Contains the script used to implement the logic of your script component,
depending on what type of COM component you are creating. Lets say for example, if you are
creating a COM Automation component, you declare properties, methods, and events in a
<public> element, and then write the script to define them in one or more <script>
elements.
<object> element Contains information about an object that you use in your script, such as
another COM component.
<resource> elements Contain values that should not be hard-coded into script component
code. Resource elements can include information that might change between versions, strings
that might be translated, and other values.
<Reference> element References a type library you want to use in script.
<comment> elements Contain text that is ignored when the script component is parsed and
executed.
Note If you are concerned that the .wsc files you create contain XML that conforms to XML
dards, you can specify that the script component's XML parser check the XML syntax. Lets say
for example, this is useful if you think you might someday use an XML editor to work with
your files. Otherwise, however, it is not usually a concern.
Skeleton Script Component File
The following example illustrates how to construct a script component file.
<?XML version="1.0"?>
<package>
<?component error="true" debug="true"?>
<comment>
This skeleton shows how script component elements are
assembled into a .wsc file.
</comment>
<component id="MyScriptlet">
<registration
progid="progID"
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
description="description"
version="version"
clsid="{00000000-0000-0000-000000000000}"/>
<Reference object="progID">
<public>
<property name="propertyname"/>
<method name="methodname"/>
<event name="eventname"/>
</public>
<implements type=COMhandlerName id=internalName>
(interface-specific definitions here)
</implements>
<script scripting language="VBScript">
<![CDATA[
dim propertyname
Function methodname()
' Script here.
End Function
]]>
</script>
<script scripting language="JScript">
<![CDATA[
function get_propertyname()
{ // Script here.
}
function put_propertyname(newValue)
{ // Script here.
fireEvent(eventname)
}
]]>
</script>
<object id="objID" classid="clsid:00000000-0000-0000-000000000000">
<resource ID="resourceID1">string or number here</resource>
<resource ID="resourceID2">string or number here</resource>
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
</component>
</package>
Dependencies on Tools etc: Its very much possible do the entire scripting using
notepad/wordpad. But also there are some 3rd party tools also available like editplus etc.
Some freeware as well as shareware.
MS also provides a tool that can be downloaded from
http://msdn.microsoft.com/scripting/scriptlets/wz10en.exe
Other optional components that can make the work easier are:
Script component wizard: can be downloaded from
http://msdn.microsoft.com/scripting/scriptlets/sce10.exe
A copy of Script Component documentation can be obtained from:
http://msdn.microsoft.com/scripting/scriptlets/serverdocs.html
Runtime Dependencies, if any:
Scrobj.dll is the interpreter used
Other Dependencies to run .exe files under scripts”
Can be executed as a command line in DOS.
Lets say for example, you need to run a command line along with vbs.
In order to do this you should be able to access the Runtime method, within WshShell Object,
and the syntax would be “c:\\Program Files\resource kit\inuse.exe”
f:\\server\winnt\system32\test.dll
The syntax would be: wscript.run(command,[windowstyle],[waitonretrun]). Wait on return in
this case would be either either true or false(Boolean).
Set ObjWS = Wscript.CreateObject(Wscript.shell”)
ObjWS.Run (INUSE.EXE f:\test.dll \server\winnt\System32\test.dll”, 0, “true”)
What is Programming: And how is it associated with Script Engine & Associated States
The Script Engines can be used various scenarios based on requirements. Test Automation
happens to be one of them. It becomes all the more important to keep its architecture as
simple as possible. Lets say for example, a server-based host may need to preserve a multi
threaded design while using Windows Script in an efficient manner. At the same time, a host
that does not use threading, such as a typical application, should not be burdened with
threading management. Windows Script achieves this balance by restricting the ways a free-
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
threaded scripting engine can call back to the host, freeing hosts from this burden.
The way its been built, synching happens to be the responsibility of the scripting engine. For
scripting engines that are not internally reentrant, or for scripting language models that are
not multithreaded, synchronization could be as simple as serializing access to the scripting
engine with a mutex. Of course certain methods, such as
IActiveScript::InterruptScriptThread, should not be serialized in this way so that a stuck
script can be terminated from another thread.
In India, there is a very popular story, that's there from generations about a rabit, who on
seeing a Cat closes his eye believing that the tester will not see him and thus his life will be
spared. Ignorance cannot be a bliss, esp if it is killing you. The same is true with the
Computing world also. Either it has to high(1) or low(0), and if you try to make a tri-state,
you are destined to perish.
So the real fact remains that IActiveScript is typically free-threaded generally implies that the
IActiveScriptSite interface and the host's object model should be free-threaded as well. This
would make implementation of the host quite difficult, particularly in the common case where
the host is a single-threaded Microsoft Windows-based application with single-threaded or
apartment-model ActiveX Controls in its object model. For this reason, the following
constraints are placed on the scripting engine's use of IActiveScriptSite:
The script site is always called in the context of a host thread. That is, the scripting engine
never calls the script site in the context of a thread that the scripting engine created, but only
from within a scripting engine method that was called from the host through IActiveScript and
its derivatives, through the exposed scripting engine's dispatch object, through a Windows
message, or from an event source in the host's object model.
The script site is never called from within the context of a simple thread state control method
(for example, the IActiveScript::InterruptScriptThread method) or from the
IActiveScript::Clone method.
Objects and Interfaces: What's different/What's Common:
Interfaces: IUnknown and IDispatch are the most commonly used, which is described later in
the chapter.
The main Object identifiers are: Class ID, Prog ID, and GUI ID, primarily used to access
properties and methods.
VBS For Test Automation:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
The process more or less remains the same as we have seen for other scripting languages,
and its only the syntax that varies:
Sub Main
Dim obj
' Request to handle errors ourselves so we can handle possible failure
' of GetObject() to connect to Word...
'
On Error Resume Next
' Gets an instancd of Word if it is already running
'
Set obj = GetObject(,"Word.Application")
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
$Word->ActiveDocument->PrintOut({
Background => 0,
Append => 0,
Range => wdPrintAllDocument,
Item => wdPrintDocumentContent,
Let's start with the simplest possible script, one that creates an instance of Microsoft Excel
and then adds a new workbook to that instance:
objExcel.Workbooks.Add
That was easy enough, wasn't it? Save your new script as a .vbs file and run it; when you do,
your desktop should look something like this (depending, of course, on the wallpaper you're
using):
OWA has been designed to be as modular as possible, and to provide as rich a scriptable
interface as possible when used with Internet Explorer 5.5
Since the Internet Explorer supports Automation, you can access its functionality from Visual
Basic. You can make the objects in the Internet Explorer available to Visual Basic 4.0 through
the References dialog box. The References dialog box lists all the objects available to Visual
Basic. You access the dialog box by selecting Tools/References from the menu barshows the
References dialog box with a Reference set to the Internet Explorer object library. The proper
Reference is described in the dialog box as "Microsoft Internet Controls."
Once a Reference is set in Visual Basic, you can exploit the objects in code. Lets say for
example, to get an instance of the Internet Explorer browser that can be accessed from Visual
Basic, you could use the following code:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Just as you can access the Internet Explorer object model from Visual Basic, you can access
the scripting object model from Microsoft Visual Basic, Scripting Edition. The scripting object
model, which provides access to the browser, is a collection of objects that can be accessed
by any scripting engine. VBScript accesses the scripting object model when it is executing
code in an HTML page. Developers can also exploit the scripting object model in VBScript
code. The scripting object model supports a variety of properties and methods for use directly
in VBScript. shows the complete scripting model, which is discussed in detail in the sections
that follow.
The Window object is the object that represents the Internet Explorer. The properties,
methods, and events defined in Tables 3-3, 3-4, and 3-5 can be called directly in VBScript
without qualification—meaning that the Window object does not need to be specified. The
following code shows an example using the Confirm method:
<SCRIPT LANGUAGE="VBScript">
</SCRIPT>
There is a book on the said topic, which is pretty exhaustive and one of the best I have read.
Perl Debugger pocket Reference by Richard Foley
On a fresh installed Operating System, try to find *.bat. There will be a huge list of batch files
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
the vendor still uses for many short cut jobs and it makes a lot of sense. Reason is simplicity,
practicality and the highest is the speed. The GUI's are the ones that suck a lot of processing
power,which if done via CLI based tools makes it a much easier and faster quick aruond
solution. Ask a geek and he will smile.
For Software Testing also, it can be used to do a lot of tasks in much simpler manner. And I
have been doing it for years now.
Lets get hands on:
1. Internal Scripts: straignt executes line by line as the normal scripting languages work
2 External Scripts: incokes the specific program and returns the result. Lets say invoking
microsoft word.application using winbatch. But there are so many tricks and
The name of any script created should not be same as a dos command. The way DOS engine
has been implemented within windows is such that it treats all internal commands as .
exe/com/winbatch.
All external commands are treated as ext commans and no internal checks are done by the
OS. .com and .exe are the typical examples of external commands.
Timing plays a very big role in developing test systems. And most of us are not even aware
that DOS supports it to some extent. Yes it really does.
PAUSE:
IF: I have seen if playing a very critical role as far as automating sysadmin tasks are
concerned.
Comparing and assigning: winbatch is based on teh same old concepts of assignment and
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Error Handling and interpretations: DOS has a command "CHOICE" which plays a major role
in handling errors and intrrpratons: . Lets say if any program ends by Ctrl + C, the resultant
value is 3, and if it is null, the errr level evaluates to 0
The return value from the keyboard is taken as error level b ........
ex: CHOICE[string][c:keys][/S][/N][/t:ke,secs]
/C: keys defines the possible keys to be pressed. if options are mentioned then the
default Y/N keys are used.
ex: CHOICE/C:A1T) ; says that A.1,T and O are the possible keys during execution if
undefined key is clicked would resut in a beep and the script would keep executing.
/t:key;secs defines the key which would trigger in case the certain amount of time has
passed.
Syntax
Parameters
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
\\ComputerName
Specifies a remote computer. If you omit this parameter, at schedules the commands and
programs on the local computer.
ID
/delete
Cancels a scheduled command. If you omit ID, all of the scheduled commands on the
computer are canceled.
/yes
Answers yes to all queries from the system when you delete scheduled events.
hours:minutes
Specifies the time when you want to run the command. Time is expressed as
hours:minutes in 24-hour notation (that is, 00:00 [midnight] through 23:59).
/interactive
Allows command to interact with the desktop of the user who is logged on at the time
command runs.
/every:
Runs command on every specified day or days of the week or month (for example, every
Thursday, or the third day of every month).
date
Specifies the date when you want to run the command. You can specify one or more days
of the week (that is, type M,T,W,Th,F,S,Su) or one or more days of the month (that is,
type 1 through 31). Separate multiple date entries with commas. If you omit date, at
uses the current day of the month.
/next:
Runs command on the next occurrence of the day (for example, next Thursday).
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
command
Specifies the Windows command, program (that is, .exe or .com file), or batch program
(that is, .bat or .cmd file) that you want to run. When the command requires a path as
an argument, use the absolute path (that is, the entire path beginning with the drive
letter). If the command is on a remote computer, specify Universal Naming Convention
(UNC) notation for the server and share name, rather than a remote drive letter.
/?
Remarks
Schtasks is a more powerful superset command-line scheduling tool and includes all the
functionality found in the at command-line utility. Use schtasks instead of at for all
command-line scheduling tasks. For more information about schtasks, see Related
Topics.
Using at
Loading Cmd.exe
At does not automatically load Cmd.exe, the command interpreter, before running
commands. If you are not running an executable (.exe) file, you must explicitly load
Cmd.exe at the beginning of the command as follows:
When you use at without command-line options, scheduled tasks appear in a table
formatted similar to the following:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
When you include identification number (ID) with at at a command prompt, information
for a single entry appears in a format similar to the following:
Task ID: 1
Status: OK
Schedule: Each F
After you schedule a command with at, especially a command that has command-line
options, check that the command syntax is correct by typing at without command-line
options. If the information in the Command Line column is incorrect, delete the
command and retype it. If it is still incorrect, retype the command with fewer
command-line options.
Viewing results
Commands scheduled with at run as background processes. Output is not displayed on the
computer screen. To redirect output to a file, use the redirection symbol (>). If you
redirect output to a file, you need to use the escape symbol (^) before the redirection
symbol, whether you are using at at the command line or in a batch file. For example,
to redirect output to Output.text, type:
The current directory for the executing command is the systemroot folder.
If you change the system time at a computer after you schedule a command to run with
at, synchronize the at scheduler with the revised system time by typing at without
command-line options.
Storing commands
Scheduled commands are stored in the registry. As a result, you do not lose scheduled
tasks if you restart the Schedule service.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Do not use a redirected drive for scheduled jobs that access the network. The Schedule
service might not be able to access the redirected drive, or the redirected drive might
not be present if a different user is logged on at the time the scheduled task runs.
Instead, use UNC paths for scheduled jobs. For example:
Do not use the following syntax, where x: is a connection made by the user:
at 1:00pm my_backup x:
If you schedule an at command that uses a drive letter to connect to a shared directory,
include an at command to disconnect the drive when you are finished using the drive.
If the drive is not disconnected, the assigned drive letter is not available at the
command prompt.
Examples
at \\marketing
To learn more about a command with the identification number 3 on the Corp server,
type:
at \\corp 3
To schedule a net share command to run on the Corp server at 8:00 A.M. and redirect the
listing to the Maintenance server, in the Reports shared directory, and the Corp.txt
file, type:
To back up the hard drive of the Marketing server to a tape drive at midnight every five
days, create a batch program called Archive.cmd, which contains the backup
commands, and then schedule the batch program to run, type:
To cancel all commands scheduled on the current server, clear the at schedule information
as follows:
at /delete
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
To run a command that is not an executable (that is, .exe) file, precede the command
with cmd /c to load Cmd.exe as follows:
Formatting legend
Format Meaning
Ellipsis (...) Parameter that can be repeated several times in a command line
Between braces ({}); choices separated by pipe (|). Example: {even|odd} Set of choices
from which the user must choose only one
C:\>help
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Office App
Sys Admin
Security Testing
Web Testing
Mailer Testing
Mobile Testing
Protocol Testing
Device Drivers Testing
Testing Embedded Systems
Data Driven Testing
Boundary Testing
Regression testing
Performance Testing
Stress testing
Autobuild to Installer Testing
Notifications related Testing
Program Management Testing
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
To configure settings to collect crash dumps, go to Control Panel and click on the System.
Select the Advanced panel, and click on the Startup and Recovery Settings button.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
You will see the dialog box shown on this slide. Select the 64KB dump size. The dump
directory shows where to get dump files you will send us. %SystemRoot% generally is
c:\windows for XP, c:\winnt for 2K.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Follow the procedure on the previous slide, and select a Kernel or a Complete dump instead.
As shown, the somewhat larger dump does not configure to create a new file for each dump,
but will overwrite previous dump files.
If a system goes into a hung state, Microsoft has provided a mechanism to break out, and
invoke the crash dump mechanism.
Once enabled, you can crash your system (and create a dump) by hitting CTRL-ScrollLock
twice.
http://oca.microsoft.com/EN/FAQ.asp
Microsoft Windows itself has a couple of tools and support associated which can be used. I
have tried to capture a couple of handy references from our/Testers perspective. Otherwise
there really is a whole world out there to be digged out.
Invoke Dr Watson
To open Dr. , click Start, and then click Run. In the Open box, type drwtsn32.
Dr. cannot prevent errors from occurring, but the information recorded in the log file can be
used by technical support personnel to diagnose the problem.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
For the options that can be tracked using task Manager, I have provided just 1 screen cap for
the purpose of brievity. Its more or less self explainatory.
Windows provides information about computer performance and displays details about
programs and processes running on your computer. If you are connected to a network, you
can also view network status and see at a glance how your network is functioning. Depending
on your work environment and whether you share your computer with other users, you can
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
1. Memory
2. Inherint Memory
4. Memory Testing
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Microsoft Windows has also come a long way starting from old 3.1 3.11 In order to access this
in the latest OS'es, just right click on my computer, and click the manage button. Microsoft
Guys called it Microsoft Management Console (MMC to be presise).
In one snapshot it almost gives the entire computer management including System Tools,
Storages to Services and Applications, and that also can be tailed as per own requirements.
2. Security log
3. Application log
4. System Log:
5. Performance Monitor
Performance Logs and Alerts takes Windows to a very higher level maturity in terms of
effective tracking and debugging support to the extent of adding Process Ids, Objects, and
Counters associated.
And this also to the extent of pre-configuring the timing to log, along with locations and other
support.
I have just provided a screen capture for a handy Reference. I have been using this
exhaustively a lot and it really happens to be amazing wizard.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Problem: Microsoft Word hangs when the document size increases to …. It hangs
forever with no option but to kill the process, this is a question that my current
manager, Dr Ravi Shankar had asked me recently.
He did not seem to be convinced by my answer, the techies need live proofs. So here it is.
If thread stack doesn’t solve it, get a memory dump of the process address space and attach
it to bugzilla. This will save you from the miserable task of re-produceing everytime.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
The “System” process is another “multi-service process” Windows NT 4.0: PID 2, Windows
2000: PID 8, Windows XP:
PID 4
Contains kernel-mode system threads
Functions in OS and some drivers that need to run as real threads
E.g., need to run concurrently with other system activity, wait
timers, perform background “housekeeping” work
System threads can be in other processes
Look for threads with 100% kernel mode time
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
3. Kernel Errors
A database repository for information about a computer's configuration. The registry contains
information that Windows continually references during operation, such as:
2. The programs installed on the computer and the types of documents each can create.
The registry is organized hierarchically as a tree and is made up of keys and their subkeys,
hives, and value entries.
registry boot
The default boot option used by most Windows DNS servers. When registry boot is used, DNS
is started and initialized using DNS parameters and their values as they are stored in the
Windows registry. You can use a Berkeley Internet Name Domain (BIND) boot file as an
alternative to this method of boot configuration for DNS.
A universal maximum for registry space that prevents an application from filling the paged
pool with registry data. The total amount of space that can be consumed by registry data
(hives) is restricted by the registry size limit.
The part of an object's distinguished name that is an attribute of the object itself. For most
objects this is the Common Name attribute. For security principals, the default common name
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
is the security principal name, also referred to as the SAM account name.
Using System Information for Generating Information: found under system tools can be
used to gather system information right from hardware to software. Starts from Hardware
Resources to Software environment, device drivers to OLE Registration and Windows Error
reporting.
Please refer to the screen capture below. I have marked/highlighted the areas to make it
intuitive.
6.4.9 Some Third Party Automation Tools: Comments and Technical details:
Load and Performance Test Tools
Loadea - Stress testing tool runs on WinXP; free evaluation version for two virtual users.
Capture module provides a development environment, utilizes C# scripting and XML based
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
data. Control module defines, schedules, and deploys tests, defines number of virtual users,
etc. Analysis module analyzes results and provides reporting capabilities.
HostedToolbox - Hosted load testing service from hostedLABS, LLC. Browser based test script
recording, no downloads or system requirements Works with any client or server. Executed
from hostedLAB's distributed infrastructure with servers in multiple locations.
Test Complete Enterprise - Automated test tool from AutomatedQA Corp. includes web load
testing capabilities.
WebPartner Test and Performance Center - Test tool from WebPartner for stress tests, load
performance testing, transaction diagnostics and website monitoring of HTTP/HTTPS web
transactions and XML/SOAP/WSDL web services.
QuotiumPro - Web load testing tool from Quotium Technologies SA. Capabilities include:
cookies managed natively, making the script modelling phase shorter; HTML and XML parser,
allowing display and retrieval of any element from a HTML page or an XML flux in test scripts;
option of developing custom monitors using supplied APIs; more.
LoadDriver - Load test tool from Inforsolutions emphasizes ease of use; directly drives
multiple inces of MSIE, rather than simulating browsers. Supports browser-side
scripts/objects, HTTP 1.0/1.1, HTTPS, cookies, cache, Windows authentication. Tests can be
scriptlessly parameterized with data from text files or custom ODBC data source, for
individual userID, password, page to start, think times, data to enter, links to click, cache,
initial cache state, etc.
Test Perspective Load Test - Do-it-yourself load testing service from Keynote Systems for
Web applications. Utilizes Keynote's load-generating infrastructure on the Internet; conduct
realistic outside-the-firewall load and stress tests to validate performance of entire Web
application infrastructure.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
SiteTester1 - Load test tool from Pilot Software Ltd. Allows definition of requests, jobs,
procedures and tests, HTTP1.0/1.1 compatible requests, POST/GET methods, cookies, running
in multi-threaded or single-threaded mode, generates various reports in HTML format, keeps
and reads XML formatted files for test definitions and test logs. Requires JDK1.2 or higher.
NetworkTester - Tool (formerly called 'NetPressure') from Agilent Technologies uses real user
traffic, including DNS, HTTP, FTP, NNTP, streaming media, POP3, SMTP, NFS, CIFS, IM, etc. -
through access authentication systems such as PPPOE, DHCP, 802.1X, IPsec, as necessary.
Unlimited scalability; GUI-driven management station; no scripting; open API. Errors isolated
and identified in real-time; traffic monitored at every step in a protocol exchange (such as
time of DNS lookup, time to logon to server, etc.). All transactions logged, and detailed
reporting available.
WAPT - Web load and stress testing tool from SoftLogica LLC. Handles dynamic content and
HTTPS/SSL; easy to use; support for redirects and all types of proxies; clear reports and
graphs.
OpenLoad - Affordable and completely web-based load testing tool from OpenDemand;
knowledge of scripting languages not required - web-based recorder can capture and
translate any user action from any website or web application. Generate up to 1000
simultaneous users with minimum processor.
ANTS - Advanced .NET Testing System from Red Gate Software. A load and stress testing tool
focused on .NET web applications, including XML Web Services. ANTS generates multiple
concurrent users via recordable Visual Basic .NET scripts and records the user experiences, at
the same time performance counter information from Windows system is integrated into the
results.
Apache JMeter - Java desktop application from the Apache Software Foundation designed to
load test functional behavior and measure performance. Originally designed for testing Web
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Applications but has since expanded to other test functions; may be used to test performance
both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases
and Queries, FTP Servers and more). Can be used to simulate a heavy load on a server,
network or object to test its strength or to analyze overall performance under different load
types; can make a graphical analysis of performance or test server/script/object behavior
under heavy concurrent load.
TestMaker - Free open source utility maintained by PushToTest.com and Frank Cohen, for
performance, scalability, and functional testing of Web application. A framework and utility to
build and run intelligent test agents that implement user behaviors and drive the system as
users would. Features an XML-based scripting scripting language and library of test objects to
create test agents. Includes capability to check and monitor email systems using SMTP, POP3,
IMAP protocols. Java-based tool - runs on any platform.
Webhammer - Low-cost utility by Stephen Genusa designed to test Web applications and
servers. Configurable 1-16 connections per system CPU.
Web Polygraph - Freely available benchmarking tool for caching proxies, origin server
accelerators, L4/7 switches, and other Web intermediaries. Other features: for high-
performance HTTP clients and servers, realistic traffic generation and content simulation,
ready-to-use standard workloads, powerful domain-specific configuration scripting language,
and portable open-source implementation. C++ source available; binaries avail for Windows.
OpenSTA - 'Open System Testing Architecture' is a free, open source web load/stress testing
application, licensed under the Gnu GPL. Utilizes a distributed software architecture based on
CORBA. OpenSTA binaries available for Windows.
PureLoad - Java-based multi-platform performance testing and analysis tool from Minq
Software. Includes 'Comparer' and 'Recorder' capabilities, dynamic input data, scenario
editor/debugger, load generation for single or distributed sources.
ApacheBench - Perl API for Apache benchmarking and regression testing. Intended as
foundation for a complete benchmarking and regression testing suite for transaction-based
mod_perl sites. For stress-testing server while verifying correct HTTP responses. Based on the
Apache 1.3.12 ab code. Available via CPAN as .tar.gz file.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Torture - Bare-bones Perl script by Lincoln Stein for testing web server speed and
responsiveness and test stability and reliability of a particular Web server. Can send large
amounts of random data to a server to measure speed and response time of servers, CGI
scripts, etc.
WebSpray - Low-cost load testing tool from CAI Networks; includes link testing capabilities;
can simulate up to 1,000 clients from a single IP address; also supports multiple IP addresses
with or without aliases. .
eValid - Web test tool from Software Research, Inc that uses a 'Test Enabled Web Browser'
test engine that provides browser based 100% client side quality checking, dynamic testing,
content validation, page performance tuning, and webserver loading and capacity analysis.
WebPerformance Trainer - Load test tool emphasizing ease-of-use, from WebPerformance Inc.
Supports all browsers and web servers; simulates up to 750 users per playback machine at
various connection speeds; records and allows viewing of exact bytes flowing between
browser and server; no scripting required. Modem simulation allows each virtual user to be
bandwidth limited. Can automatically handle variations in session-specific items such as
cookies, usernames, passwords, IP addresses, and any other parameter to simulate multiple
virtual users. , Linux, Solaris, most UNIX variants.
FORECAST - Load testing tool from Facilita Software for web, client-server, network, and
database systems. Capabilities include proprietary, Java, or C++ scripting; windows browser
or network recording/playback. Network traces can also be taken from over 15 third party
tracing tools. Virtual user data can be parameterized. Works with a wide variety of platforms.
e-Load - Load test tool from Empirix Software; for use in conjunction with test scripts from
their e-Tester functional test tool. Allows on-the-fly changes and has real-time reporting
capabilities. Includes script editor with advanced debugging and maintenance capabilities.
Works with a wide variety of platforms.
QALoad - Compuware's QALoad for load/stress testing of web, database, and char-based
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
systems. Integration with other Compuware tools provides an in-depth view by monitoring its
operating system, database and network components, as well as the application itself. Works
with a variety of databases, middleware, ERP.
Microsoft WCAT load test tool - Web load test tool from Microsoft for load testing of MS IIS
servers; other MS stress tools also listed.
Portent Web Load test tool - Loadtesting.com's low-priced web load testing tool. Has minimal
processor requirements. Page validation via matching string in page. Written in Java; multi-
platform.
Radview's WebLoad - Load testing tool from Radview Software, also available as part of their
TestView web testing suite. Capabilities include over 75 Performance Metrics; can view global
or detailed account of transaction successes/failures on individual Virtual Client level,
assisting in capturing intermittent errors; allows comparing of running test vs. past test
metrics. Test scripting via visual tool or Javascript. Wizard for automating non-GUI-based
services testing; DoS security testing.
Loadrunner - Mercury's load/stress testing tool for web and other applications; supports a
wide variety of deployment environments, platforms, and databases. Large suite of
network/app/server monitors to enable performance measurement of each
tier/server/component and tracing of bottlenecks. Integrates with other Mercury testing and
monitoring producs.
Koalog Code Coverage - Code coverage analyzer for Java applications from Koalog SARL.
Includes: in-process or remote coverage computation, capability of working directly on Java
method binaries (no recompilation), predefined (XML, HTML, LaTex, CSV, TEXT) or custom
report generation, and session merging to allow compilation of overall results for distinct
executions. Integrates with Ant and JUnit.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
HTML/DOM-Aware and Object Mode Recording Engine, and a Data-Driven, Adaptable and
Multi-Threaded Playback Engine. Handles Applets, Flash, Active-X controls, animated
bitmaps, etc. Controls are recorded as individual objects independent of screen positions or
resolution; playback window/size can be different than in capture. Special validation points,
such as bitmap or text matching, can be inserted during a recording, but all recorded items
are validated and logged 'on the fly'. Fuzzy matching capabilities. Editable scripts can be
recorded in SmithSript scripting language or in Java, C++ or C++/MFC. 90-day evaluation
copy available.
QA Wizard - Automated functional web test tool from Seapine Software. Advanced object
binding reduces script changes when Web-based apps change. Next-generation scripting
scripting language eliminates problems created by syntax or other scripting language errors.
Includes capability for automated scripting, allowing creation of more scripts in less time.
Supports unlimited set of ODBC-compatible data sources as well as MS Excel, tab/comma
delimited file formats, and more. Free Demo and est Script available. platforms.
HttpUnit - Open source Java program for accessing web sites without a browser, from
SourceForge.net/Open Source Development Network, designed and implemented by Russell
Gold. Ideally suited for automated unit testing of web sites when combined with a Java unit
test framework such as JUnit. Emulates the relevant portions of browser behavior, including
form submission, basic http authentication, cookies and automatic page redirection, and
allows Java test code to examine returned pages as text, an XML DOM, or containers of forms,
tables, and links. Includes ServletUnit to test servlets without a servlet container.
MaxQ - Free open-source web functional testing tool from Tigris.org, written in Java. Works as
a proxy server; includes an HTTP proxy recorder to automate test script generation, and a
mechanism for playing tests back from the GUI and command line. Jython is used as the
scripting scripting language, and JUnit is used as the testing library.
WebKing - Web site functional, load, and static analysis test suite from ParaSoft. Maps and
tests all possible paths through a dynamic site; can enforce over 200 HTML, CSS, JavaScript,
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
508 compliance, WML and XHTML coding dards or customized dards. Allows creation of rules
for automatic monitoring of dynamic page content. Can run load tests based on the tool's
analysis of web server log files. , Linux, Solaris.
Rational Functional Tester - IBM's (formerly Rational's) automated tool for testing of Java, .
NET, and web-based applications. Enables data-driven testing, choice of scripting languages
and editors. and Linux.
Winrunner - Functional/regression test tool from Mercury; includes support for testing Web,
Java, ERP, etc.
Compuware's QARun - QARun for functional/regression testing of web, Java, and other
applications. Handles ActiveX, HTML, DHTML, XML, Java beans, and more.
SilkTest - Functional test tool from Segue for Web, Java or traditional client/server-based
applications. Features include: test creation and customization, test planning and
management, direct database access and validation, recovery system for unattended testing,
and IDE for developing, editing, compiling, running, and debugging scripts, test plans, etc.
Watchfire's AppScan - Tool suite from Watchfire automates web application security testing,
produces defect analyses, and offers recommendations for fixing detected security flaws.
Assessment module can be used by auditors and compliance officers to conduct
comprehensive audits, and to validate compliance with security requirements.
Acunetix Web Vulnerability Scanner - Web site security testing tool from Acunetix first
identifies web servers from a particular IP or IP range. It then crawls entire site, gathering
information about every file it finds, and displaying website structure. After this discovery
stage, it performs an automatic audit for common security issues. Applications utilizing CGI,
PHP, ASP, ASP.NET can all be tested for vulnerabilities such as cross site scripting, SQL
injection, CRLF injection, code execution, directory traversal and more. Requires Windows and
MSIE.s
Codenomicon HTTP Test Tool - Tool for discovering and eradicating security-related flaws in
HTTP implementations via robustness testing. Tool systematically generates very large
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Lightning Console - Security management tool from Tenable Network Security for multiple
security and network administrators across multiple organizations. Scheduled vulnerability
scanning, real-time IDS event analysis, asset management, remediation management of
vulnerabilities, network topology discovery and organizational executive reporting for
hundreds of administrators via easy-to-use web interface.
SARA - 'Security Auditor's Research Assit' Unix-based security analysis tool from Advanced
Research Corp. Supports the FBI/SANS Top 20 Consensus; remote self scan and API facilities;
plug-in facility for third party apps; SANS/ISTS certified, updated bi-monthly; CVE dards
support; based on the SATAN model. Freeware. Also available is 'Tiger Analytical Research
Assit' (TARA), an upgrade to the TAMU 'tiger' program - a set of scripts that scan a Unix
system for security problems.
Qualys Free Security Scans - Several free security scan services from Qualys, Inc. including
SANS/FBI Top 20 Vulnerabilities Scan, network security scan, and browser checkup tool.
Qualys Guard - Online service that does remote network security assessments; provides
proactive 'Managed Vulnerability Assessment', inside and outside the firewall,
Nessus Security Scanner - Free, open-source remote network security auditing tool, by
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Renaud Deraison, based on 'never trust the version number' and 'never trust that a given
service is listening on the good port'. Nessus is made up of two parts : a server and a client;
the server (nessusd) manages the 'attacks', whereas the client is a frontend designed to
collect the results. Includes more than 1000 tests in 23 vulnerability categories, and Nessus
Attack Scripting scripting language. Works with a variety of operating systems.
NetRecon - Network vulnerability assessment scanner from Symantec. Scans systems and
services on the network and safely simulates common intrusion or attack scenarios. Utilizes a
root-cause and path-analysis engine to illustrate exact sequence of steps taken to uncover
vulnerabilities, enabling identification of exactly where to correct vulnerabilities to enforce
corporate security policies. Learns about network as it scans, adapting penetration strategy
based on previous results. Customizable reporting. Can scan a variety of operating systems;
product runs on Windows.
SAINT - Security Administrator's Integrated Network Tool - Security testing tool from SAINT
Corporation. An updated and enhanced version of the SATAN network security testing tool.
Updated regularly; CVE compatible. Includes DoS testing, reports specify severity levels of
problems. Single machine or full network scans. Also available is 'WebSAINT' self-guided
scanning service, and SAINTbox scanner appliance. Runs on many UNIX flavors.
SilkCentral Performance Monitor - Tool from Segue Software, Inc., actively monitors and
evaluates the health of a site's live applications utilizing synthetic business transactions.
Passive monitoring records real user sessions and reliably detects and logs all error situations
encountered by real-users. Recorded transactions can then be analyzed when production
errors occur and fed back into SilkPerformer for real-world performance testing scenarios.
Cuevision Network Monitor - Monitoring tool from Cuevision for monitoring website, server,
services, applications, and network; capabilities include notifications via email, net send, and
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
GFI Network Server Monitor - Server management tool from GFI Software Ltd. checks
network and servers for failures and fixes them automatically. Alerts via email, pagers, SMS;
automatically reboot servers, restart services, run scripts, etc. Freeware version of GFI
Network Server Monitor is also available; includes modules to check HTTP and ICMP/ping for
checking availability of HTTP and HTTPS sites.
IP Check - Server monitoring tool from Paessler GmbH. Alerts webmasters if a webserver is
not working correctly because the web service is down, CGI scripts return errors or the SQL
server is not reachable. It can contly monitor any number of servers and ports.
IBM Workplace Web Content Management - IBM's web content management product for
Internet, intranet, extranet and portal sites; runs on both Lotus Domino and IBM WebSphere.
WebCheck - Windows application from ITUtils that runs in background and periodically checks
a site for availability and correctness; searches for keywords; provides notification by
displaying a message or sending an e-mail. Requires MSIE.
WS_FTP Pro - FTP/web publishing tool from Ipswitch; manage, upload, and update websites;
automatically resume interrupted transfers; support more than 50 host file systems; drag-
and-drop files; for Windows.
SiteScope - Mercury's product for agentless site monitoring and maintenance. Runs on
servers and monitors server performance, links, connections, logs, etc.; scheduled and on-
demand reporting; provides notifications of problems. Includes published API for creating
custom monitors. Monitors mimic users' end-to-end actions. or Unix.
6.4.10Log
6.4.10Log Analysis Tools
HTTPD Log Analyzers list - Includes categories for Access Analyzers, Agent Analyzers, Referrer
Analyzers, Error Analyzers, Other Log Analyzers. Most extensive log analysis tool listing on
the net. Includes listing of other log analyzer lists. The access analyzers list includes more
than 100 listed with short descriptions of each, Eclipse TPTP Testing Tools Project - TPTP (Test
& Performance Tools Platform) is a subproject of Eclipse, an open platform for tool
integration. TPTP provides frameworks for building testing tools by extending the TPTP
Platform. The framework contains testing editors, deployment and execution of tests,
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
execution environments and associated execution history analysis and reporting. The project
also includes exemplary tools for JUnit based component testing tool, Web application
performance testing tool, and a manual testing tool. The project supports the OMG UML2 Test
Profile.
Test Architect - Keyword-driven test automation tool from LogiGear helps increase test
coverage. Built-in playback support for web-based application and other platforms.
Networking and Server Test Utilities - Small collection of web server and other test utilities.
Morae - Usability test tool for web sites and software, from TechSmith Corp. for automated
recording, analyzing and sharing of usability data. Consists of 3 components. A Recorder
records and synchronizes video and data, creating a digital record of system activity and user
interaction. A Remote Viewer enables geographically dispersed observers to watch usability
tests from any location; it displays test user's computer screen along with a picture-in-picture
window displaying the test participant's face and audio; Remote Viewer observers can set
markers and add text notes. The Manager component includes integrated editing functionality
for assembly of important video clips to share with stakeholders.
AutoTestFlash - Freeware tool by Tiago Simoes for recording and playing back UI Tests in
flash applications.
Repro - Manual testing 'helper' tool that records desktop video, system operations in 7
different categories, system resource usage, and system configuration information. Allows
user to save and review relevant information for bug reports, and compress the result into a
very small file to replay, upload to a bug tracking system, and share with others. Instruments
in memory the target application at runtime so no changes are required to application under
test. .
URL2image.com - Service from HREF Tools to check web page appearance in different
Browser/OS combinations. For anyone interested in css, web dards and elastic design; can
specify the screen width(s), font magnification(s) and page position(s) for the proofs. Enter
URL and receive back report with screenshots taken in real time on real processor.
FREEping - Free ping software utility from Tools4ever which will ping all your Windows-based
servers (or any other IP address) in freely-definable intervals. Will send a popup when one of
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
IP Traffic Test and Measure - Network traffic simulation and test tool from Omnicor Corp. can
generate TCP/UDP connections using different IP addresses; data creation or capture and
replay; manage and monitor throughput, loss, and delay.
Sandra - 'System ANalyser, Diagnostic and Reporting Assit' utility from SiSoftware. Provides
large variety of information about a Windows system's processor and software. Includes CPU,
mainboard, drives, ports, processes, modules, services, device drivers, ODBC sources,
memory details, environment settings, system file listings, and much more. Provides
performance enhancing tips, tune-up wizard, file system and memory bandwidth
benchmarking, more. Reporting via save/print/fax/email in text, html, XML, etc. Free,
Professional, and other versions available in multiple languages.
Dummynet - Flexible tool developed by Luigi Rizzo, originally designed for testing networking
protocols, can be used in testing to simulate queue and bandwidth limitations, delays, packet
losses, and multipath effects. Can be used on user's workstations, or on FreeBSD machines
acting as routers or bridges.
MRTG - Multi Router Traffic Grapher - free tool utilizing SNMP to monitoring traffic loads on
network links; generates reports as web pages with GIF graphics on inbound and outbound
traffic.
As I said earlier, this can be used by engineer's, who aspire to get into building career in the
subject. And with respect to our subject, it wouldn't have been worth it not talking about
various Organizations and Certifications associated.
SEI - Software Engineering Institute web site; info about SEI technical programs,
publications, bibliographies, some online documents, SEI courses and training, links to
related sites.
IEEE Standards - IEEE web site; has Software Engineering dards titles and prices; the topical
areas for publications of interest would include listings in the categories of Software
Design/Development and Software Quality and Management.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
American Society for Quality - American Society for Quality (formerly the American Society
for Quality Control) web site; geared to quality issues in general, not just Software QA. ASQ
is the largest quality organization in the world, with more than 100,000 members. Provides a
wide variety of general quality-related certifications, as well as the CSQE (Certified Software
Quality Engineer).
Society for Software Quality - Has chapters in San Diego, Delaware, and Washington DC area;
each with monthly meetings.
CSQE - ASQ (American Society for Quality) CSQE (Certified Software Quality Engineer)
program - information on requirements, outline of required 'Body of Knowledge', listing of
study references and more.
CSQA/CSTE - QAI (Quality Assurance Institute)'s program for CSQA (Certified Software
Quality Analyst), CSTE (Certified Software Test Engineer), and Certified Software Project
Manager (CSPM) certifications.
ISEB Software Testing Certifications - The British Computer Society maintains a program of 2
levels of certifications - ISEB Foundation Certificate, Practitioner Certificate.
ISTQB Certified Tester - The International Software Testing Qualifications Board is a part of
the European Organization for Quality - Software Group, based in Germany. The certifications
are based on experience, a training course and test. Two levels are available: Foundation and
Advanced.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
software. The data and actions can be more easily maintained - such as via a spreadsheet -
since they are separate from the test drivers. The test drivers 'read' the data/action
information to perform specified tests. This approach can enable more efficient control,
development, documentation, and maintenance of automated tests/test cases.
Test Script: The captured test steps are stored by the Software Test Automation Tools in a
test script equivalent to C or Basic. With all the functions of a programming scripting
language in the test script (case differentiation, loops, subroutines), even complex test
processes can be implemented.
Checkpoints: In order to determine if the program being tested (SuT: Software under Test)
is functioning correctly or if there have been any errors, the tester (during the test capture or
in the script editing) can insert additional checkpoints in the test script. By this means the
layout-relevant characteristics of windows-objects (color, position, size, etc.) can be verified
along with functional characteristics of the SuT (a mask value, contents of a message box,
etc.).
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Replaying Tests: Once captured, tests can be replayed and thus in principal are repeatable
at any time. The aforementioned object-oriented test capture permits GUI elements to be re-
recognized when the test is repeated, even if the GUI has meanwhile been modified by a
change in the software. If the test object behaves differently during a repeat test or if
checkpoints are violated, then the test fails. The Software Test Automation Tools records this
as an error in the test object.
Tool vendors promote Software Test Automation Tools as a very fast and easy method of
automating GUI testing. But in reality there are lots of traps or pitfalls which can impair the
effectiveness of Software Test Automation Tools based testing. To understand where and
why, we have to take a closer look at GUI's and GUI testing.
A GUI which is not designed fosr the Test Automation in perspective can be a daunting task.
There are Object Implementations which do not give.
Go for Scripting Interfaces, than GUI's.
Backup registry & system image
network
shortcut’s
url
collections
specialforder
OS Architecture:
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Although it is out of scope, still I wanted to give a higher level one shot description to make
the audiences understand in a snapshot.
Here in I have taken Symbian, the most common Operating System found in most of the
mobile devices we have today.
1. One of the most important factors is the test code/development code does not become
bulky enough so that it results in making it self un-magenable. It always need to be
there at the back of the minds and communicated to the stake holders that the
objective of automation is testing, and not build a bulky system which itself becomes
harder to manage.
2. Take backup of the registry in case you intend to put the application to threshold
conditions/expect crashes.
3. Always take image of the system also, in case you intend to put the system to
threshold conditions/expect crashes.
6.4.11Some
6.4.11Some Clarifications
Why I picked up MS Office as an example:
Reason being this is the 1st and foremost requirement for building any test system. Inside-
out knowledge of the application that you intend to automate.
1. Testers Skill-Sets: Everyone wants to be a developer and not a tester, why? Because
developers think that its a low skilled job. But testers knowledge skill-sets are very
different and broad from development. It requires strong Operating Systems skillsets
(including internals), databases, usability testing, scripting, networking, SDLC to
processes compliances. Quality (CMM, ISO etc) and a lot more.
Problems with the Test Industry with respect to our subject: No tailored course and no
specific benchmarking guidelines. All abstracts everywhere. But things have been changing,
with certifications (both tools and engineering). Things hav... but not enough to convince
everyone.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
It calls for:
Fair insights into Operating System Concepts:
Scripting/Programming: Once I was interviewing a guy for embedded tools testing and I
asked him about the languages he's comfortable with for writing test plans. His answer was
English. Is that wrong, i really do not know. I am referring to one of the world's biggest
semiconductor company.
On the other hand, on a training session the traineer was referring to test scripts. And later it
turned out to be simple english test steps. And this happened in one of the worlds best
Security Org.
Bit of everything
Everything about 1~2 things.
Do I make sense???
3. Has anyone seen an application with HWTTF....., ie, the menu starting from Help,
Window, Tools and so on from the Left Hand Side. Similar happens to be with all the
Usability/GUI's and more or less goes back to what Microsoft had implemented.
4. How would you define a bug that is least severity and still remains to be priority. Has
anyone come across any product by Microsoft that displays Win instead of Windows.
Bet you will not be able to find it as for Microsoft guys this would be of last severity
but the top-most priority.
5. Measuring Quality: So how do you measure Quality. The simple answer is across what
is set as a standard that the product claims to be capable of.
6. QA/QC: There cannot be any other term to start with especially with respect to our
subject. Hundreds and thousands of books/jobs/references/links/tutorials/lectures etc
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
etc that I have come across and each one talks about QA and not about QC/software
testing. I think the industry is yet to reach such a maturity stage where these terms
get defined. QA is a non technical job (a more of a process oriented targeted for
certification, in most of the cases, although proves out to be an umbrella activity
putting Software Testing under it, which is a pure technical job.
7. White Box Testing: And all the time, it reminds me of a continent about everyone
wants to talk about as much as they possibly can. And when you are told, or try to go
there everyone runs away like a thief saving for his life. Reason is simple, Whitebox
testing is nothing but a glass box testing, where in each and every
function/unit/module/subroutine..... is tested as per the coding guidelines specified.
The only thing that a tester can do here is compliance checks with respect to the
coding guidelines being followed or not. Having audits, incorporating comments and so
on. Also this is true mostly for larger size organizations. For very small startups or thin
engineering firms, multitasking makes more sense where the developers mostly do the
development as well as testing.
10. White Box Expectations from Testers: Since the time I started by career, hardly has
any interview/conference/training/event happened wherein the said subject has not
been refered to.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
6.4.12Live
6.4.12Live Examples & Proofs:
Can Web development be more techie job than lets say embedded testing.
Can VB development be more technically demanding than lets say Codec Testing(any form).
1. Smoke Tests
2. Installer Tests
3. Sanity Tests
5. Auto mailers
6.4.13Lessons
6.4.13Lessons Learnt from the Book
The theory behind any innovation remains to be the same, objective in terms of the task to
be accomplished is all the more important than the tool. Learning MS Word, Framemaker,
pagemaker will not make you a technical writer. But if you are a good technical writer, you
will learn any tool very fast.
Knowing the inside out functionality of whatever you need to achieve/automate is all the
more important than the tool needed to do so. Know. Knowing the former will lower the
struggle to a large extent. The best way to do it test test test, and only then automate.
6.4.14Where
6.4.14Where to Go from Here:
1. Open any Application, lets say any component of Microsoft Office or alternatively any
software you are comfortable with and start.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
2. Automating bit by bit using any scripting language you know/aspire to know.
4. Then put small pieces (subroutines), together as a 1 single master script and all
subroutines under it as we had discussed during start of the book.
Start putting in validations once you are able to do this. I am sure you are going to enjoy it.
Do share your experience with me.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
6.4.15Touching
6.4.15Touching the Extremes/Cherish towards Intelligence Perfection
This happens to be my all time favorite subject. Key to Intelligent Scripting and Automation
Auto Responders: Try to bring in interactiveness in mailing systems, so that even if you are
physically not there, the automation infrastructure takes care.
Bill Gates example: during the early IT years, I had read that in his house, the electronic
controls are automated right from lighting to the phones. Whereever he goes, the automation
takes care of enabling and also disabling where he has left.
Home Automation
Building Bluetooth proximity Systems: Today I was trying to do something with Bluetooth
and eventualy ended up in putting a camera in the car and then monitoring it over the phone.
Don't ask me the price guys, the cellphone I already had and web cams are available at throw
away prices. Later I checked with the site of the cellphone vendor and the similar product was
available at Inr 20,000/- and what I spent was just Rs 200 (Indian Currency)
Robotics in our daily Life
Fuzzy Logics
Wearable Computers
Today I know that it is very much possible. Try it guys, its a lot of fun. Get stuck up,
call me and I will give you tips.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
• GEARING UP FOR THE FUTURE: WHAT LIES AHEAD, AND WHAT ARE GOING TO BE THE TESTING CHALLENGES
1. The highly demanding customers have overpaced over development efforts & the world
seems to go towards virtual with lesser physical Interactiveness.
2. road ahead ~ vista
3. convergence in technologies and implementations
4. security challenges
5. boot loaders, ini's, registry, dats, profiles file systems, ctrl panel. problems of
bulkiness ms 2 pr speeds ~ Intel. When Microsoft was always working on to stabilize, the
Intel towards speeding up the things. Each complementing the other. The times seem to
be changing now. That's another reason Microsoft has really not been able to penetrate so
far, and neither is Intel.
6. X86 2 MIPS, & ARM: Symbian to Smartphone and Win CE & challenges. Testing
competencies & skill sets r always different from others. OS insights, scripting,
methodologies. Usability insights to awareness. problems when industry itself is evolving
@ greater pace before stabilizing. ex re?ent roll out of 11n products on the basis of 2.0
draft itself.
7. Vendors have already started pushing out end to end solutions targeted for various line of
customers. For example, Microsoft itself releasing a MobileDevice, accompanied with OS
(of course), apps, and additional support for various apps lets say WiFi. Not only this, the
financial softwares to anti-viruses/anti-spammers based on the target audiences. Along
with this the challenges for testing are going to grow manyfold.
Security Challenges:
2. Secuirity happens to be one of the biggest threats I have seen till date. What makes it
worst is the lack of technical expertise of the law enforcers.
Some Proofs:
1. The biggest aution site which was taken over by again the world's biggest player was being
used to sell some offensive video by students. And the cops caught hold of the CEO and
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
2. Yesterday, when I was travelling in the market, found some cops in Cyber Cafe. They
were taken away and were given some non-sense reason. The guys were released but
there entire infrastructure was taken over by the cops.
3. On the other hand, there are so many security flaws in almost everything where
technology is involved right from banking to telecom.
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
This one is very interesting, you start using Vista a bit, you will keep getting the message box
as displayed in Figure 30.
And similar happens to be with the biggest Chipsets vendors also, they have
focussing primarily towards the speed to meet the high demands. That's
another reason why none of them have still not been able to make a significant
penetration into embedded space.
There was a very old quote that I had read once which said “Windows is a complicated
System with a programming layer on top of it (API), which merely hides. Sooner or
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Personally I definitely see a lot of change in the trend which has been over the past decade.
During my Engineering School, there was a pal who was always more eager to do anything
except studying. Once a professor asked him as to why he does not study, his answer was,
“more studies more confusion, no studies no confusion”. The guy was very right to some
extent.
Its been a couple of years since this idea of going ahead on this was in my mind. IT is a
demanding career, and I was doing this along with regular job. Today I really feel that there
are 100’s of things in the book that could have been done better. Maybe in the next version, I
will address some of those issues and to improve on the feedback that I receive.
data-dimensions.com
xprogramming.com
the-scientist.com
vb controls: mvps.org/ccrp
11mauto.htm
kaner.com
testing.com
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
io.com
www.data-dimensions.com/testers/network/11mauto.htm
kaner.com
xprogramming.com/practices/
www.testers.com
www.io.com
qualitytree.com
codecs.microsoft.com/isapi/ocget.dll
www.the-scientist.com
Object Identifiers:
WSH:script object
shell
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
http://www.yahoo.com/Computers_and_Internet/Programming_Languages/Perl/ -
http://www.automationworld.com/
Web Resources on Software Testing
Software Testing
Automation
www.perl.com
www.activeperl.com
www.cpan.org
www.perlmonks.com
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/scripting.asp
http://www.geekarticles.com/Test-Automation
http://www.winbatch.com/
www.cpan.org
Rational
PurifyPlus RealTime
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Rational® PurifyPlus
Rational® Purify®
Rational® PureCoverage®
Rational® Quantify
Qarun
Silk
Winrunner
Microsoft's Word.application
Open Office
Uability Testing
www.sqatester.com
www.stickyminds.com
www.Hdtune.com
www.testing.com
www.io.com
www.the-scientist.com
www.qualitytree.com
http://qualitytree.com
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
http://grantbibson.co.uk/misc/readyboost
www.automationworld.com
www.indiantestingboard.com
http://www.automationworld.com/
www.gutenberg.com
www.sourceforge.net
www.indyacellular.in
www.automationjunkies.com
Books that I would recommended: had there been any book on this, then I would'not
have come up with this. But yes there are a couple of books out there which impressed me
but are targeted for specific audiences & technologies. I have read every bit of them and
found them very useful.
3. Windows API
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Alphabetical Index
100p., 125
Generic Test Automation Template..............................................................................
Template..............................................................................98
98
: Installers Tracking and information...........................................................................
information...........................................................................176
176
: Log Generation Support by Microsoft Windows............................................................
Windows............................................................181
181
: Task Manager Support by Microsoft Windows.............................................................
Windows............................................................. 179
' examplefor updating filesystems using registry objects................................................
objects................................................ 124
' SendKeys example..................................................................................................
example..................................................................................................122
122
'A typical challenge for GUI based automation, implementing sendkeys'...................
sendkeys'................... 122, 124
'Using vbs & Wsh to implement web/word/text authoring...............................................
authoring...............................................119
119
# In All Things be men..............................................................................................
men..............................................................................................101
101
# Testing for Databases using ADO.............................................................................
ADO.............................................................................116
116
# Validating Client Script Interactiveness.....................................................................
Interactiveness.....................................................................157
157
#OLE for Test Automation..........................................................................................
Automation..........................................................................................132
132
$INET = new Win32::Internet();.................................................................................
Win32::Internet();.................................................................................143
143
Tips........................................................................................................................
Tips........................................................................................................................9
9
Precautions and Suggested workarounds....................................................................
workarounds.................................................................... 9
Maturity in Test Automation..................................................................................
Automation..................................................................................9,
9, 13
A Generic Template: Master Script................................................................................
Script................................................................................98
98
Architectural Mapping between Objects in Windows and Checks in Test Automation Tools....
Tools.... 72
Architectural Mapping between Objects in Windows and Checks in Test Automation Tools ... 72
Architectural View of Microsoft Windows Operating System..............................................
System.............................................. 71
Code Window 1..........................................................................................................
1..........................................................................................................98
98
Conventions.................................................................................................................
Conventions.................................................................................................................8
Figure 10: Perl validations with backend 2...................................................................
2................................................................... 118
Figure 18: Using Dr Watson for Effective Reporting.......................................................
Reporting....................................................... 178
Javascript for interactiveness testing...........................................................................
testing...........................................................................162
162
Lets Try with VBS+ OLE Implementation......................................................................
Implementation......................................................................101
101
My $Outlook = Win32::OLE->new('Outlook........................................................
Win32::OLE->new('Outlook........................................................104,
104, 113p.
Ole Automation Implementation with Perl....................................................................
Perl.................................................................... 104
Perl for Web testing ..................................................................................................120
..................................................................................................120
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
• AUTHOR: ABHINAV VAID IN ALL THINGS BE MEN
Other Resources..................................................................................................
Resources..................................................................................................212
212
Other References/ Technical Articles by Author (The published ones).........................
ones)......................... 213
Building Automated Test Systems –Microsoft Windows Version 2.0 Page numbers
i Xml with OOPS Implementation