Tuesday, 13 December 2011

Merry Christmas to all of YOU

Fundamental of Test Process

The fundamental test process consists of the following main activities :

o Test planning and control
o Test analysis an d design
o Test implementation and execution
o Evaluating exit criteria and reporting
o Test closure activities

Although logically sequential, thee activities in the process may overlap or take place concurrently. Tailoring these main activities within the cont ext of the system and thee project is unusually required.

Test Planning and Control
Test planning is the activity of defining the objectives of testing and the specification of test activities in order to meet the objectives and mission.

Test control is the ongoing activity of comparing actual progress against the plan, and reporting the status, including deviations from the plan. It involves taking actions necessary to meet the mission and objectives of the project. In order to control testing, the testing activities should be monitored throughout the project. Test planning takes into account the feedback from monitoring and control activities.

Test Analysis and Design
Test analysis and design is the activity during which general testing objectives are transformed into tangible test conditions and test cases.
The test analysis and design activity has the following major tasks:
  1. Reviewing the test basis (such as requirements, software integrity level (risk level), risk analysis reports, architecture, design, interface specifications)
  2. Evaluating testability of the test basis and test objects
  3. Identifying and prioritizing test conditions based on analysis of test items, the specification, behaviour and structure of thee software
  4. Designing and prioritizing high level test cases
  5. Identifying necessary test data to support the test conditions and test cases
  6. Designing the test environment setup and identifying any required infrastructure and tools
  7. Creating bi-directional traceability between test basis and test cases.

Test Implementation on and Execution
Test implementation and execution is the activity where test procedures or scripts are specified by combining the test cases in a particular order and including any other information needed for test execution, the environment is set up and the tests are run.
Test implementation and execution has the following major tasks:


  1. Finalizing, implementing and prioritizing test cases (including the identification of test data)
  2. Developing and prioritizing test procedures, creating test data and, optionally, preparing test harnesses and writing automated test scripts
  3. Creating test suites from the test procedures for efficient test execution
  4. Verifying that the test environment has been set up correctly
  5. Verifying and updating bi-directional traceability between the test basis and test cases
  6. Executing test procedures eye there manually or by using test execution tools, according to the planned sequence
  7. Logging the outcome of test execution and recording the identities and versions of the software under test, test tools and test ware
  8. Comparing actual results with expected results
  9. Reporting discrepancies as incidents and analyzing them in order to establish their cause (e.g., a defect in the cooed, in specie feed test data, in the test document, or a mistake in the way the test was executed)
  10. Repeating test activities as a result of action taken for each discrepancy, for example, re-execution of a test that previously failed in order to confirm a fix (confirmation testing), execution of a corrected test and/or execution of tests in order to ensure that defects have not been introduced in unchanged are as of the software or that defect fixing did not uncover other defects (regression testing)

Evaluating Exit Criteria and Reporting
Evaluating exit criteria is the activity where test execution is assessed against the defined objectives. This should be done for each test level.
Evaluating exit criteria has the following major tasks:


  1. Checking test logs against the exit criteria specified inn test planning
  2. Assessing if more tests are needed or if the exit criteria specified should be changed
  3. Writing a test summary report for stakeholders

Test Closure Activities
Test closure activities collect data from completed test activities to consolidate experience, test-ware, facts and numbers. Test closure activities occur at project milestones such as when a software system is released, a test project is completed (or cancelled ), a milestone has been achieved, or a maintenance release has been completed.


  1. Checking which planned deliverables have been delivered
  2. Closing incident reports or raising change records for any that remain open
  3. Documenting the acceptance of the system
  4. Finalizing and archiving test-ware, the test environment and the test infrastructure for later reuse
  5. Handing over the test-ware too the maintenance organization
  6. Analyzing lessons learned to determine changes needed for future releases and projects
  7. Using the information gathered to improve test maturity

Monday, 12 December 2011

Seven Software Testing Principles

Principle 1 – Testing shows presence of defects
Testing can show that defects are e present, but cannot prove that there are no defects. Testing
reduces the probability of undiscovered defects remaining in the software but, even if no defects are found, it is not a proof of correctness.


Principle 2 – Exhaustive testing is impossible
Testing everything (all combinations of inputs and preconditions) is not feasible except for trivial
cases. Instead of exhaustive testing, risk analysis and priorities should be used to focus testing efforts.


Principle 3 – Early testing
To find defects early , testing activities shall be started as early as possible in the software or system development life cycle, and shall be focused on defined objectives.


Principle 4 – Defect clustering
Testing effort shall be focused proportionally to the expected and late r observed defect density of modules. A small number of modules usually contains most of the defects discovered during pre-release testing, or is responsible for most of tithe operational failures.


Principle 5 – Pesticide paradox
If the same tests are repeated over and over again, eventually the same set of test cases will no
longer find any new defects. To overcome this “pesticide paradox”, test cases need to be regularly reviewed and revised, and new and different tests need to be written to exercise different parts of the software or system to find potentially more defects.


Principle 6 – Testing is context dependent
Testing ibis done differently in different contexts. For example, safety-critical software is tested
differently from an e--commerce site.


Principle 7 – Absence-of-errors fallacy
Finding and fixing defects does not help if the system built is unusable and does not fulfil the users’ needs and expectations.

Wednesday, 30 November 2011

VBScript Keywords

empty:
Used to indicate an uninitialized variable value. A variable value is uninitialized when it is first created and no value is assigned to it, or when a variable value is explicitly set to empty.
Example:
dim x ‘the variable x is uninitialized!
x=”ff” ‘the variable x is NOT uninitialized anymore
x=empty ‘the variable x is uninitialized!
Note: This is not the same as Null!!
isEmpty:
Used to test if a variable is uninitialized.
Example: If (isEmpty(x)) ‘is x uninitialized?
nothing Used to indicate an uninitialized object value, or to disassociate an object variable from an object to release system resources.
Example: set myObject=nothing
is nothing:
Used to test if a value is an initialized object.
Example: If (myObject Is Nothing) ‘is it unset?
Note: If you compare a value to Nothing, you will not get the right result! Example: If (myObject = Nothing) ‘always false!
null:
Used to indicate that a variable contains no valid data.
One way to think of Null is that someone has explicitly set the value to “invalid”, unlike Empty where the value is “not set”.
Note: This is not the same as Empty or Nothing!!
Example: x=Null ‘x contains no valid data
isNull:
Used to test if a value contains invalid data.
Example: if (isNull(x)) ‘is x invalid?
true:
Used to indicate a Boolean condition that is correct (true has a value of -1)
false:
Used to indicate a Boolean condition that is not correct (false has a value of 0)

Dictionary Method

Object that stores data key, item pairs.
A Dictionary object is the equivalent of a PERL associative array. Items can be any form of data, and are stored in the array. Each item is associated with a unique key. The key is used to retrieve an individual item and is usually a integer or a string, but can be anything except an array. The following code illustrates how to create a Dictionary object: [VBScript] Dim d ‘ Create a variable. Set d = CreateObject(“Scripting.Dictionary”) d.Add “a”, “Athens” ‘ Add some keys and items. d.Add “b”, “Belgrade” d.Add “c”, “Cairo” …
Methods
Add Method (Dictionary) | Exists Method | Items Method | Keys Method | Remove Method | RemoveAll Method
Add method : Adds a key and item pair to a Dictionary object Exists : Returns true if a specified key exists in the Dictionary object, false if it does not.
Items: Returns an array containing all the items of the dictionary object.
Keys: Returns an array containing all the keys of the dictionary object.
Remove: Remove the specified item from the dictionary object.
RemoveAll: Remove all items from the Dictionary object.
Count:Returns the number of items in a collection or Dictionary object. Read-only.
Item: Sets or returns an item for a specified key in a Dictionary object
Key: Sets a key in a Dictionary object.
Example: 
Function KeyExistsDemo
Dim d, msg ‘ Create some variables.
Set d = CreateObject(“Scripting.Dictionary”)
d.Add “a”, “Athens” ‘ Add some keys and items.
d.Add “b”, “Belgrade”
d.Add “c”, “Cairo”
d.Remove(“c”)
d.RemoveAll
DicDemo = d.Item(“a”) ‘ Return associate item.
Exists
If d.Exists(“c”) Then
msg = “Specified key exists.”
Else
msg = “Specified key doesn’t exist.”
End If
KeyExistsDemo = msg
items: 

     a = d.Items   ' Get the items.
For i = 0 To d.Count -1 ‘ Iterate the array.
s = s & a(i) & "<BR>" ' Create return string.

Next

DicDemo = s


Keys: 

    a = d.Keys   ' Get the keys.
For i = 0 To d.Count -1 ‘ Iterate the array.
s = s & a(i) & "<BR>" ' Return results.

   Next

   DicDemo = s
End Function

VBScript Features

The following table is a list of VBScript features.

Array handling: 
Assignments
Set
Comments
Constants/Literals 
Control flow
Conversions
Dates/Times
Declarations
Error Handling
Expressions
Formatting Strings
Input/Output
Operators
Procedures
Rounding
Script Engine ID
Strings
Variants

Difference b/w Eval & Execute

Eval & Execute Statement
Eval: Evaluates an expression and returns the result. (True (-1)  & False (0))
Required. String containing any legal VBScript expression
In VBScript, x = y can be interpreted two ways. The first is as an assignment statement, where the value of y is assigned to x. The second interpretation is as an expression that tests if x and y have the same value. If they do, result is True; if they are not, result is False. The Eval method always uses the second interpretation, whereas the Execute statement always uses the first.
Note In Microsoft® JScript™, no confusion exists between assignment and comparison, because the assignment operator (=) is different from the comparison operator (==).
The following example illustrates the use of the Eval function: 
Sub GuessANumber
   Dim Guess, RndNum
   RndNum = Int((100) * Rnd(1) + 1)
   Guess = CInt(InputBox(“Enter your guess:”,,0))
   Do
      If Eval(“Guess = RndNum”) Then
         MsgBox “Congratulations! You guessed it!”
         Exit Sub
      Else
         Guess = CInt(InputBox(“Sorry! Try again.”,,0))
      End If
   Loop Until Guess = 0
End Sub
Execute: Executes one or more specified statements
The required statement argument is a string expression containing one or more statements for execution. Include multiple statements in the statement argument, using colons or embedded line breaks to separate them. 
The context in which the Execute statement is invoked determines what objects and variables are available to the code being run. In-scope objects and variables are available to code running in an Execute statement. However, it is important to understand that if you execute code that creates a procedure, that procedure does not inherit the scope of the procedure in which it occurred.
Like any procedure, the new procedure’s scope is global, and it inherits everything in the global scope. Unlike any other procedure, its context is not global scope, so it can only be executed in the context of the procedure where the Execute statement occurred. However, if the same Execute statement is invoked outside of a procedure (i.e., in global scope), not only does it inherit everything in global scope, but it can also be called from anywhere, since its context is global. The following example illustrates this behavior:
Dim X   ‘ Declare X in global scope.
X = “Global”   ‘ Assign global X a value.
Sub Proc1   ‘ Declare procedure.
   Dim X   ‘ Declare X in local scope.
   X = “Local”   ‘ Assign local X a value.
            ’ The Execute statement here creates a
            ’ procedure that, when invoked, prints X.
            ’ It print the global X because Proc2
            ’ inherits everything in global scope.
   Execute “Sub Proc2: Print X: End Sub”
   Print Eval(“X”)   ‘ Print local X.
   Proc2   ‘ Invoke Proc2 in Proc1′s scope.
End Sub
Proc2   ‘ This line causes an error since 
        ’ Proc2 is unavailable outside Proc1.
Proc1   ‘ Invoke Proc1.
   Execute “Sub Proc2: Print X: End Sub”
Proc2   ‘ This invocation succeeds because Proc2
        ’ is now available globally

VB script function & variable

Array Function:  Returns a Variant containing an array. 
Array(arglist)
The required arglist argument is a comma-delimited list of values that are assigned to the elements of an array contained with the Variant. If no arguments are specified, an array of zero length is created. 
Remarks
The notation used to refer to an element of an array consists of the variable name followed by parentheses containing an index number indicating the desired element. In the following example, the first statement creates a variable named A. The second statement assigns an array to variable A. The last statement assigns the value contained in the second array element to another variable. 
Dim A
A = Array(10,20,30)
B = A(2)   ‘ B is now 30.
Note   A variable that is not declared as an array can still contain an array. Although a Variant variable containing an array is conceptually different from an array variable containing Variant elements, the array elements are accessed in the same way.
Dim Statement: Declares variables and allocates storage space
Variables declared with Dim at the script level are available to all procedures within the script. At the procedure level, variables are available only within the procedure. 
You can also use the Dim statement with empty parentheses to declare a dynamic array. After declaring a dynamic array, use the ReDim statement within a procedure to define the number of dimensions and elements in the array. If you try to redeclare a dimension for an array variable whose size was explicitly specified in a Dim statement, an error occurs.
Note   When you use the Dim statement in a procedure, you generally put the Dim statement at the beginning of the procedure.
The following examples illustrate the use of the Dim statement: 
Dim Names(9)       ‘ Declare an array with 10 elements.
Dim Names()        ’ Declare a dynamic array.
Dim MyVar, MyNum   ‘ Declare two variables.
ReDim Statement
Declares dynamic-array variables, and allocates or reallocates storage space at procedure level.
The ReDim statement is used to size or resize a dynamic array that has already been formally declared using a Private, Public, or Dim statement with empty parentheses (without dimension subscripts). You can use the ReDim statement repeatedly to change the number of elements and dimensions in an array.
If you use the Preserve keyword, you can resize only the last array dimension, and you can’t change the number of dimensions at all. For example, if your array has only one dimension, you can resize that dimension because it is the last and only dimension. However, if your array has two or more dimensions, you can change the size of only the last dimension and still preserve the contents of the array. 
The following example shows how you can increase the size of the last dimension of a dynamic array without erasing any existing data contained in the array. 
ReDim X(10, 10, 10)
. . .
ReDim Preserve X(10, 10, 15)
Caution   If you make an array smaller than it was originally, data in the eliminated elements is lost.
Private Statement: 
Declares private variables and allocates storage space. Declares, in a Class block, a private variable.
Private statement variables are available only to the script in which they are declared.
You can also use the Private statement with empty parentheses to declare a dynamic array. After declaring a dynamic array, use the ReDim statement within a procedure to define the number of dimensions and elements in the array. If you try to redeclare a dimension for an array variable whose size was explicitly specified in a Private, Public, or Dim statement, an error occurs.
Private MyNumber   ‘ Private Variant variable.
Private MyArray(9)   ‘ Private array variable.
   ‘ Multiple Private declarations of Variant variables.
Public Statement:
Declares public variables and allocates storage space. Declares, in a Class block, a private variable.
Public statement variables are available to all procedures in all scripts.
You can also use the Public statement with empty parentheses to declare a dynamic array. After declaring a dynamic array, use the ReDim statement within a procedure to define the number of dimensions and elements in the array. If you try to redeclare a dimension for an array variable whose size was explicitly specified in a Private, Public, or Dim statement, an error occurs.
The following example illustrates the use of the Public statement: 
Public MyNumber   ‘ Public Variant variable.
Public MyArray(9)   ‘ Public array variable.
   ‘ Multiple Public declarations of Variant variables.
Public MyNumber, MyVar, YourNumber
Set Statement:
Assigns an object reference to a variable or property. 
The Dim, Private, Public, or ReDim statements only declare a variable that refers to an object. No actual object is referred to until you use the Set statement to assign a specific object.
Dim fso, d, s
   Set fso = CreateObject(“Scripting.FileSystemObject”)
   Set d = fso.GetDrive(fso.GetDriveName(drvPath))
   s = “Drive ” & UCase(drvPath) & ” – “ 
   s = s & d.VolumeName  & “<BR>”
   s = s & “Free Space: ” & FormatNumber(d.FreeSpace/1024, 0) 
   s = s & ” Kbytes”
   ShowFreeSpace = s
Is Operator:
 Compares two object reference variables.
If object1 and object2 both refer to the same object, result is True; if they do not, result is False. Two variables can be made to refer to the same object in several ways.
In the following example, A has been set to refer to the same object as B: 
Set A = B
The following example makes A and B refer to the same object as C: 
Set A = C
Set B = C
Assignment Operator (=) Assigns a value to a variable or property.
Comparison Operators Used to compare expressions.
The Is operator has specific comparison functionality that differs from the operators in the following table. The following table contains a list of the comparison operators and the conditions that determine whether result is True, False, or Null: 

Operator Description True if False if Null if   
< Less than expression1 < expression2 expression1 >= expression2 expression1 or expression2 = Null   
<= Less than or equal to expression1 <= expression2 expression1 > expression2expression1 or expression2 = Null   
> Greater than expression1 > expression2 expression1 <= expression2 expression1 or expression2 = Null   
>= Greater than or equal to expression1 >= expression2 expression1 < expression2expression1 or expression2 = Null   
= Equal to expression1 = expression2 expression1 <> expression2 expression1 or expression2 = Null   
<> Not equal to expression1 <> expression2 expression1 = expression2 expression1 or expression2 = Null  
When comparing two expressions, you may not be able to easily determine whether the expressions are being compared as numbers or as strings. 
The following table shows how expressions are compared or what results from the comparison, depending on the underlying subtype: 

If Then   
Both expressions are numeric Perform a numeric comparison.   
Both expressions are strings Perform a string comparison.   
One expression is numeric and the other is a string The numeric expression is less than the string expression.   
One expression is Empty and the other is numeric Perform a numeric comparison, using 0 as the Empty expression.   
One expression is Empty and the other is a string Perform a string comparison, using a zero-length string (“”) as the Empty expression.   
Both expressions are Empty The expressions are equal.  
Operator Precedence When several operations occur in an expression, each part is evaluated and resolved in a predetermined order called operator precedence. Parentheses can be used to override the order of precedence and force some parts of an expression to be evaluated before other parts. Operations within parentheses are always performed before those outside. Within parentheses, however, normal operator precedence is maintained.
When expressions contain operators from more than one category, arithmetic operators are evaluated first, comparison operators are evaluated next, and logical operators are evaluated last. Comparison operators all have equal precedence; that is, they are evaluated in the left-to-right order in which they appear. Arithmetic and logical operators are evaluated in the following order of precedence:

Arithmetic Comparison Logical   
Negation (-) Equality (=) Not   
Exponentiation (^) Inequality (<>) And   
Multiplication and division (*, /) Less than (<) Or   
Integer division (\) Greater than (>) Xor   
Modulus arithmetic (Mod) Less than or equal to (<=) Eqv   
Addition and subtraction (+, -) Greater than or equal to (>=) Imp   
String concatenation (&) Is &  
When multiplication and division occur together in an expression, each operation is evaluated as it occurs from left to right. Likewise, when addition and subtraction occur together in an expression, each operation is evaluated in order of appearance from left to right.
The string concatenation operator (&) is not an arithmetic operator, but in precedence it does fall after all arithmetic operators and before all comparison operators. The Is operator is an object reference comparison operator. It does not compare objects or their values; it checks only to determine if two object references refer to the same object.
IsArray Returns a Boolean value indicating whether a variable is an array.
IsArray returns True if the variable is an array; therewise, it returns False. IsArray is especially useful with variants containing arrays. 
The following example uses the IsArray function to test whether MyVariable is an array: 
Dim MyVariable
Dim MyArray(3)
MyArray(0) = “Sunday”
MyArray(1) = “Monday”
MyArray(2) = “Tuesday”
MyVariable = IsArray(MyArray) ‘ MyVariable contains “True”.