A prevalent belief among IT folk is that automation, by default, will enhance the quality of testing.
How true is that belief?
“There is a time and place for everything”, as the popular idiom goes, and that holds true for test automation too.
Certain scenarios in which automation is generally a good option:
1. Repetitive Tests
A system that needs the same tests executed periodically is a good candidate for automation. Take for example, support projects that must perform regression tests for every PR/CR. Manual effort in such cases tends to be huge and error-prone. Automation can prove very efficient in such cases.
It makes sense to opt for a testing tool with a version controlled repository to manage the test scripts.
The cost of automation and the initial effort investment for script creation is usually greater than for manual testing, and it must be analyzed how far this investment will pay off in the end. A few pointers to help make that decision:
* How many repetitions of tests are expected, for how long? A longer “life” of the test scripts tips the scale in favor of automation.
* How expensive is the tool?
* How much time/effort will it take to create the test scripts? Automation may not simply be record-and-play, a lot of design and coding may have to go in to achieve the desired result.
* Are incremental changes expected to the scripts?
* Do testers on the team require training on the tool?
“Repetitive tests => automation” is a fair thumb rule but not an inviolable one. A costly automation setup on one hand and quick-to-build on-the-fly manual tests on the other, and you might just find that automation will not be useful even if you expect a certain number of repetitions.
2. Manually Infeasible Tests
Before an application is deployed in the production environment, it might be critical to determine how the application will behave under huge user load or when dealing with millions of records.
Such test scenarios are usually best simulated with automation. In high risk conditions, where the cost of missing a test might be disastrous, even a single-time use of automation might be a worthwhile decision.
3. Low Severity/Probability Of “Human” Bugs
Automation can perform some jobs far better than a human can hope to do. Give the tool and the human tester two excel sheets with 10,000 rows of data each to reconcile with each other. No prizes for guessing who can do it faster, without errors.
But then, humans are far better at another sort of testing. Humans can notice oddities beyond documented tests. Does the UI look too cluttered? Does the mouse flicker strangely when moved over the button? Did the screen behind the modal window just blink?
Automation is limited to testing what it is programmed to do. Not everything that the human mind can observe/analyze can be programmed, and so, automation will miss out on capturing some bugs. The question to ask is: how important are those missed-out bugs? An unstable system might not be ready for automation, as severe “manual” bugs may get ignored. Automation is better suited to systems in which the “human” bugs are expected to be fewer and are of low severity.
In Closing
A point worth remembering is that automation vs. manual does not have to be an either-or decision. A mix can work. Take a multi-step workflow – a couple of steps might be fit for automation, not the entire flow. Automate only those steps that will benefit from automation.
Friday, August 7, 2009
Wednesday, August 5, 2009
Tuesday, August 4, 2009
VBScript Operators:
VBScript Operators
Arithmetic Operators:Operators used to perform mathematical calculations.
1. Addition +
2. Subtraction -
3. Multiplication *
4. Division /
5. Integer Division \
6. Exponentiation ^
7. Modulus arithmetic Mod
8. Unary negation -
9. String concatenation &
Assignment Operator:Operator used to assign a value to a property or variable.
1. Equality =
2. Inequality <>
3. Less than <
4. Greater than >
5. Less than or equal to <=
6. Greater than or equal to >=
Comparison Operators:Operators used to perform comparisons.
Concatenation Operators:Operators used to combine strings.
Logical Operators:Operators used to perform logical operations.
1. Logical negation Not
2. Logical conjunction And
3. Logical disjunction Or
4. Logical exclusion Xor
5. Logical equivalence Eqv
6. Logical implication Imp
Arithmetic Operators:Operators used to perform mathematical calculations.
1. Addition +
2. Subtraction -
3. Multiplication *
4. Division /
5. Integer Division \
6. Exponentiation ^
7. Modulus arithmetic Mod
8. Unary negation -
9. String concatenation &
Assignment Operator:Operator used to assign a value to a property or variable.
1. Equality =
2. Inequality <>
3. Less than <
4. Greater than >
5. Less than or equal to <=
6. Greater than or equal to >=
Comparison Operators:Operators used to perform comparisons.
Concatenation Operators:Operators used to combine strings.
Logical Operators:Operators used to perform logical operations.
1. Logical negation Not
2. Logical conjunction And
3. Logical disjunction Or
4. Logical exclusion Xor
5. Logical equivalence Eqv
6. Logical implication Imp
Using Control Structures to Make Decisions:
Using If...Then...Else
Syntax
If condition Then statements [Else elsestatements ]
If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements] ...
[Else
[elsestatements]]
End If
Ex:
If condition = True Then
... the code that executes if the condition is satisfied
End If
Ex:
If bShowDetail Then MsgBox "More details. . . "
example:
sMsg = "Either you're not born yet or you're getting too old for this stuff!"
If nAge <= 0 Or nAge > 120 Then
MsgBox sMsg
bFail = True
End If
Ex:
If MyFavoriteRestaurantOpen = True Then
Msgbox "Go To My Favorite Restaurant!"
End If
If MyFavoriteRestaurantOpen = False Then
Msgbox "Go Home and Cook!"
End If
Ex:
If MyFavoriteRestaurantOpen = True Then
Msgbox "Go To My Favorite Restaurant!"
Else
Msgbox "Go Home and Cook!"
End If
Ex:
If nAge = 0 Then
MsgBox "Welcome to the human race!"
ElseIf nAge < 0 Then
MsgBox "You have to grow up a bit before you start using VBScript!"
ElseIf nAge > 0 And Age < 10 Then
MsgBox "If you're bold enough, you must be old enough."
ElseIf nAge > 120 Then
MsgBox "You're getting too old for this stuff!"
Else
MsgBox "You're at the perfect age to get started!"
End If
Allows for conditional execution of a block of code, typically out of three or
more code blocks, based on some condition. Use the Select Case statement as
an alternative to complex nested If...Then...Else statements.
Select Case
Syntax
Select Case testexpression
[Case expressionlist-n
[statements-n]] ...
[Case Else
[elsestatements]]
End Select
A Select Case statement provides capability similar to the If...Then...Else
statement, but it makes code more efficient and readable. Select Case
structure is defined as follows:
Select Case expression
Case exp-1
...this is the code that executes if exp-1 matches expression
Case exp-2, exp-3
...this is the code that executes if exp-2 or exp-3 matches expression
Case exp-4
...this is the code that executes if exp-4 matches expression
.
.
.
Case Else
...this is the code that executes if none matches expression
End Select
Example
The following example uses Select Case to read a variable populated by the
user and determine the name of the user's operating system:
Select Case Left(Environment.Value("OSVersion"), 1)
Case 1 : varOSDesc = "Windows NT"
Case 2 : varOSDesc = "Windows 98"
Case 3 : varOSDesc = "Windows 95"
Case 4 : varOSDesc = "Windows 3.11"
Case 5 : varOSDesc = "Windows 2000"
Case 6 : varOSDesc = "Windows ME"
Case 7 : varOSDesc = "Windows XP"
Case Else : varOSDesc = "OS is unknown"
End Select
Using Control Structures to Make Code Repeat:
Looping allows you to run a group of statements repeatedly. Some loops repeat statements until a condition is False; others repeat statements until a condition is True. There are also loops that repeat statements a specific number of times.
The following looping statements are available in VBScript:
Do...Loop: Loops while or until a condition is True.
While...Wend: Loops while a condition is True.
For...Next: Uses a counter to run statements a specified number of times.
For Each...Next: Repeats a group of statements for each item in a collection or
each element of an array.
Using For...Next Statement:
Defines a loop that executes a given number of times, as determined by a loop counter. To use the For...Next loop, you must assign a numeric value to a counter variable. This counter is either incremented or decremented automatically with each iteration of the loop. In the For statement, you specify the value that is to be assigned to the counter initially and the maximum value the counter will reach for the block of code to be executed. The Next statement marks the end of the block of code that is to execute repeatedly, and also serves as a kind of flag that indicates the counter variable is to be modified.
Syntax
For counter = start To end [Step stepcounter]
[statements]
[Exit For]
[statements]
Next
Arguments
Argument Description
counter
Numeric variable used as a loop counter. The variable can't be an array
element or an element of a user-defined type.
start Initial value of counter.
end Final value of counter.
step
Amount counter is changed each time through the loop. If not specified, step defaults to one.
statements
One or more statements between For and Next that are executed the specified number of times.
Using If...Then...Else
Syntax
If condition Then statements [Else elsestatements ]
If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements] ...
[Else
[elsestatements]]
End If
Ex:
If condition = True Then
... the code that executes if the condition is satisfied
End If
Ex:
If bShowDetail Then MsgBox "More details. . . "
example:
sMsg = "Either you're not born yet or you're getting too old for this stuff!"
If nAge <= 0 Or nAge > 120 Then
MsgBox sMsg
bFail = True
End If
Ex:
If MyFavoriteRestaurantOpen = True Then
Msgbox "Go To My Favorite Restaurant!"
End If
If MyFavoriteRestaurantOpen = False Then
Msgbox "Go Home and Cook!"
End If
Ex:
If MyFavoriteRestaurantOpen = True Then
Msgbox "Go To My Favorite Restaurant!"
Else
Msgbox "Go Home and Cook!"
End If
Ex:
If nAge = 0 Then
MsgBox "Welcome to the human race!"
ElseIf nAge < 0 Then
MsgBox "You have to grow up a bit before you start using VBScript!"
ElseIf nAge > 0 And Age < 10 Then
MsgBox "If you're bold enough, you must be old enough."
ElseIf nAge > 120 Then
MsgBox "You're getting too old for this stuff!"
Else
MsgBox "You're at the perfect age to get started!"
End If
Allows for conditional execution of a block of code, typically out of three or
more code blocks, based on some condition. Use the Select Case statement as
an alternative to complex nested If...Then...Else statements.
Select Case
Syntax
Select Case testexpression
[Case expressionlist-n
[statements-n]] ...
[Case Else
[elsestatements]]
End Select
A Select Case statement provides capability similar to the If...Then...Else
statement, but it makes code more efficient and readable. Select Case
structure is defined as follows:
Select Case expression
Case exp-1
...this is the code that executes if exp-1 matches expression
Case exp-2, exp-3
...this is the code that executes if exp-2 or exp-3 matches expression
Case exp-4
...this is the code that executes if exp-4 matches expression
.
.
.
Case Else
...this is the code that executes if none matches expression
End Select
Example
The following example uses Select Case to read a variable populated by the
user and determine the name of the user's operating system:
Select Case Left(Environment.Value("OSVersion"), 1)
Case 1 : varOSDesc = "Windows NT"
Case 2 : varOSDesc = "Windows 98"
Case 3 : varOSDesc = "Windows 95"
Case 4 : varOSDesc = "Windows 3.11"
Case 5 : varOSDesc = "Windows 2000"
Case 6 : varOSDesc = "Windows ME"
Case 7 : varOSDesc = "Windows XP"
Case Else : varOSDesc = "OS is unknown"
End Select
Using Control Structures to Make Code Repeat:
Looping allows you to run a group of statements repeatedly. Some loops repeat statements until a condition is False; others repeat statements until a condition is True. There are also loops that repeat statements a specific number of times.
The following looping statements are available in VBScript:
Do...Loop: Loops while or until a condition is True.
While...Wend: Loops while a condition is True.
For...Next: Uses a counter to run statements a specified number of times.
For Each...Next: Repeats a group of statements for each item in a collection or
each element of an array.
Using For...Next Statement:
Defines a loop that executes a given number of times, as determined by a loop counter. To use the For...Next loop, you must assign a numeric value to a counter variable. This counter is either incremented or decremented automatically with each iteration of the loop. In the For statement, you specify the value that is to be assigned to the counter initially and the maximum value the counter will reach for the block of code to be executed. The Next statement marks the end of the block of code that is to execute repeatedly, and also serves as a kind of flag that indicates the counter variable is to be modified.
Syntax
For counter = start To end [Step stepcounter]
[statements]
[Exit For]
[statements]
Next
Arguments
Argument Description counter
Numeric variable used as a loop counter. The variable can't be an array element or an element of a user-defined type.
start Initial value of counter.
end Final value of counter.
step
Amount counter is changed each time through the loop. If not specified, step defaults to one.
statements
One or more statements between For and Next that are executed the specified number of times.
Syntax
If condition Then statements [Else elsestatements ]
If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements] ...
[Else
[elsestatements]]
End If
Ex:
If condition = True Then
... the code that executes if the condition is satisfied
End If
Ex:
If bShowDetail Then MsgBox "More details. . . "
example:
sMsg = "Either you're not born yet or you're getting too old for this stuff!"
If nAge <= 0 Or nAge > 120 Then
MsgBox sMsg
bFail = True
End If
Ex:
If MyFavoriteRestaurantOpen = True Then
Msgbox "Go To My Favorite Restaurant!"
End If
If MyFavoriteRestaurantOpen = False Then
Msgbox "Go Home and Cook!"
End If
Ex:
If MyFavoriteRestaurantOpen = True Then
Msgbox "Go To My Favorite Restaurant!"
Else
Msgbox "Go Home and Cook!"
End If
Ex:
If nAge = 0 Then
MsgBox "Welcome to the human race!"
ElseIf nAge < 0 Then
MsgBox "You have to grow up a bit before you start using VBScript!"
ElseIf nAge > 0 And Age < 10 Then
MsgBox "If you're bold enough, you must be old enough."
ElseIf nAge > 120 Then
MsgBox "You're getting too old for this stuff!"
Else
MsgBox "You're at the perfect age to get started!"
End If
Allows for conditional execution of a block of code, typically out of three or
more code blocks, based on some condition. Use the Select Case statement as
an alternative to complex nested If...Then...Else statements.
Select Case
Syntax
Select Case testexpression
[Case expressionlist-n
[statements-n]] ...
[Case Else
[elsestatements]]
End Select
A Select Case statement provides capability similar to the If...Then...Else
statement, but it makes code more efficient and readable. Select Case
structure is defined as follows:
Select Case expression
Case exp-1
...this is the code that executes if exp-1 matches expression
Case exp-2, exp-3
...this is the code that executes if exp-2 or exp-3 matches expression
Case exp-4
...this is the code that executes if exp-4 matches expression
.
.
.
Case Else
...this is the code that executes if none matches expression
End Select
Example
The following example uses Select Case to read a variable populated by the
user and determine the name of the user's operating system:
Select Case Left(Environment.Value("OSVersion"), 1)
Case 1 : varOSDesc = "Windows NT"
Case 2 : varOSDesc = "Windows 98"
Case 3 : varOSDesc = "Windows 95"
Case 4 : varOSDesc = "Windows 3.11"
Case 5 : varOSDesc = "Windows 2000"
Case 6 : varOSDesc = "Windows ME"
Case 7 : varOSDesc = "Windows XP"
Case Else : varOSDesc = "OS is unknown"
End Select
Using Control Structures to Make Code Repeat:
Looping allows you to run a group of statements repeatedly. Some loops repeat statements until a condition is False; others repeat statements until a condition is True. There are also loops that repeat statements a specific number of times.
The following looping statements are available in VBScript:
Do...Loop: Loops while or until a condition is True.
While...Wend: Loops while a condition is True.
For...Next: Uses a counter to run statements a specified number of times.
For Each...Next: Repeats a group of statements for each item in a collection or
each element of an array.
Using For...Next Statement:
Defines a loop that executes a given number of times, as determined by a loop counter. To use the For...Next loop, you must assign a numeric value to a counter variable. This counter is either incremented or decremented automatically with each iteration of the loop. In the For statement, you specify the value that is to be assigned to the counter initially and the maximum value the counter will reach for the block of code to be executed. The Next statement marks the end of the block of code that is to execute repeatedly, and also serves as a kind of flag that indicates the counter variable is to be modified.
Syntax
For counter = start To end [Step stepcounter]
[statements]
[Exit For]
[statements]
Next
Arguments
Argument Description
counter
Numeric variable used as a loop counter. The variable can't be an array
element or an element of a user-defined type.
start Initial value of counter.
end Final value of counter.
step
Amount counter is changed each time through the loop. If not specified, step defaults to one.
statements
One or more statements between For and Next that are executed the specified number of times.
Using If...Then...Else
Syntax
If condition Then statements [Else elsestatements ]
If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements] ...
[Else
[elsestatements]]
End If
Ex:
If condition = True Then
... the code that executes if the condition is satisfied
End If
Ex:
If bShowDetail Then MsgBox "More details. . . "
example:
sMsg = "Either you're not born yet or you're getting too old for this stuff!"
If nAge <= 0 Or nAge > 120 Then
MsgBox sMsg
bFail = True
End If
Ex:
If MyFavoriteRestaurantOpen = True Then
Msgbox "Go To My Favorite Restaurant!"
End If
If MyFavoriteRestaurantOpen = False Then
Msgbox "Go Home and Cook!"
End If
Ex:
If MyFavoriteRestaurantOpen = True Then
Msgbox "Go To My Favorite Restaurant!"
Else
Msgbox "Go Home and Cook!"
End If
Ex:
If nAge = 0 Then
MsgBox "Welcome to the human race!"
ElseIf nAge < 0 Then
MsgBox "You have to grow up a bit before you start using VBScript!"
ElseIf nAge > 0 And Age < 10 Then
MsgBox "If you're bold enough, you must be old enough."
ElseIf nAge > 120 Then
MsgBox "You're getting too old for this stuff!"
Else
MsgBox "You're at the perfect age to get started!"
End If
Allows for conditional execution of a block of code, typically out of three or
more code blocks, based on some condition. Use the Select Case statement as
an alternative to complex nested If...Then...Else statements.
Select Case
Syntax
Select Case testexpression
[Case expressionlist-n
[statements-n]] ...
[Case Else
[elsestatements]]
End Select
A Select Case statement provides capability similar to the If...Then...Else
statement, but it makes code more efficient and readable. Select Case
structure is defined as follows:
Select Case expression
Case exp-1
...this is the code that executes if exp-1 matches expression
Case exp-2, exp-3
...this is the code that executes if exp-2 or exp-3 matches expression
Case exp-4
...this is the code that executes if exp-4 matches expression
.
.
.
Case Else
...this is the code that executes if none matches expression
End Select
Example
The following example uses Select Case to read a variable populated by the
user and determine the name of the user's operating system:
Select Case Left(Environment.Value("OSVersion"), 1)
Case 1 : varOSDesc = "Windows NT"
Case 2 : varOSDesc = "Windows 98"
Case 3 : varOSDesc = "Windows 95"
Case 4 : varOSDesc = "Windows 3.11"
Case 5 : varOSDesc = "Windows 2000"
Case 6 : varOSDesc = "Windows ME"
Case 7 : varOSDesc = "Windows XP"
Case Else : varOSDesc = "OS is unknown"
End Select
Using Control Structures to Make Code Repeat:
Looping allows you to run a group of statements repeatedly. Some loops repeat statements until a condition is False; others repeat statements until a condition is True. There are also loops that repeat statements a specific number of times.
The following looping statements are available in VBScript:
Do...Loop: Loops while or until a condition is True.
While...Wend: Loops while a condition is True.
For...Next: Uses a counter to run statements a specified number of times.
For Each...Next: Repeats a group of statements for each item in a collection or
each element of an array.
Using For...Next Statement:
Defines a loop that executes a given number of times, as determined by a loop counter. To use the For...Next loop, you must assign a numeric value to a counter variable. This counter is either incremented or decremented automatically with each iteration of the loop. In the For statement, you specify the value that is to be assigned to the counter initially and the maximum value the counter will reach for the block of code to be executed. The Next statement marks the end of the block of code that is to execute repeatedly, and also serves as a kind of flag that indicates the counter variable is to be modified.
Syntax
For counter = start To end [Step stepcounter]
[statements]
[Exit For]
[statements]
Next
Arguments
Argument Description counter
Numeric variable used as a loop counter. The variable can't be an array element or an element of a user-defined type.
start Initial value of counter.
end Final value of counter.
step
Amount counter is changed each time through the loop. If not specified, step defaults to one.
statements
One or more statements between For and Next that are executed the specified number of times.
Subscribe to:
Posts (Atom)